@teastain Thanks, that worked like a charm!
Best posts made by czm88
-
RE: Core2 and sprites - don't play well together?
Latest posts made by czm88
-
RE: Core2 v1.1 KmeterISO
I just wanted to give an update in the event someone comes across the same issue in the future:
I was able to get the KMeterISO to work with the Core.2 unit and using the Arduino IDE by doing the following:
-
I needed to download the M5Unit-KMeterISO library from GITHUB - https://github.com/m5stack/M5Unit-KMeterISO
-
I used the included "demo" example that was part of the library download but I had to make a few changes: I added a line "#include <M5Core2.h>" to the beginning. Added "M5.begin();" in void setup(), and finally changed the i2c pins from 21 & 22 to 32 & 33 in the kmeter.begin line - "while (!kmeter.begin(&Wire, KMETER_DEFAULT_ADDR, 32, 33, 100000L)) {"
Here is the complete modified demo example code:
#include "M5UnitKmeterISO.h" #include <M5Core2.h> #define INTERVAL_TIME 500 M5UnitKmeterISO kmeter; uint8_t error_status = 0; long delay_time = 0; long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } void setup() { M5.begin(); Serial.begin(115200); while (!kmeter.begin(&Wire, KMETER_DEFAULT_ADDR, 32, 33, 100000L)) { Serial.println("Unit KmeterISO not found"); } delay_time = millis() + INTERVAL_TIME; } void loop() { if (millis() > delay_time) { error_status = kmeter.getReadyStatus(); if (error_status == 0) { Serial.printf("Celsius Temp: %.2fC\r\n", ((float)(kmeter.getCelsiusTempValue())) / 100); Serial.printf("Fahrenheit Temp: %.2fF\r\n", ((float)(kmeter.getFahrenheitTempValue())) / 100); Serial.printf( "Chip Celsius Temp: %.2fC\r\n", ((float)(kmeter.getInternalCelsiusTempValue())) / 100); Serial.printf( "Chip Fahrenheit Temp: %.2fF\r\n", ((float)(kmeter.getInternalFahrenheitTempValue())) / 100); } else { Serial.printf("Error: %d", kmeter.getReadyStatus()); } delay_time = millis() + INTERVAL_TIME; } }
-
-
RE: Core2 v1.1 KmeterISO
@bignerd95 Did you ever get this working? I have the same problem, came here looking for help and found this post.
-
RE: Core2 and sprites - don't play well together?
@teastain Thanks, that worked like a charm!
-
Core2 and sprites - don't play well together?
Can anyone tell me if the have sprites working correctly on their Core2 and if so, did you need to do something special to make them work. I don't think there is anything wrong with my code (see below) but the numbers don't overwrite them selves neatly a create quite a mess.
Code:
#include <M5Core2.h>
#include "Bunken20pt7b.h"#define color1 0x2144
TFT_eSprite spr = TFT_eSprite(&M5.Lcd);
int backlight = 2800;
void setup() {
M5.begin(); M5.Axp.SetLcdVoltage(backlight); spr.createSprite(320,240); spr.fillSprite(color1);
}
void loop() {
M5.update(); backlight = backlight + 1; if (backlight >= 3300) backlight = 0; //M5.Axp.SetLcdVoltage(backlight); spr.setTextDatum(4); spr.setFreeFont(&Bunken20pt7b); spr.setTextColor(TFT_ORANGE,color1); spr.drawString(String(backlight),160,120); spr.pushSprite(0,0); delay(5);
}