Thanks for the help! I've got it working now :)
W
Latest posts made by wanderingchimp
-
RE: Assistance Request: M5Core2 and 4-Relay Unit
-
Assistance Request: M5Core2 and 4-Relay Unit
Good morning! I am trying to perform a simple test by flashing the LEDs and cycling the relays on a 4-relay unit board, and for some reason, the magic isn't happening, below is my code:
#include <M5Core2.h> #include "Unit_4RELAY.h" UNIT_4RELAY relay; void setup() { // Init M5Core2 And the I2C port(21,22). M5.begin(true,false,true,true); // Draw screen M5.Lcd.setCursor(0, 10); M5.lcd.setTextSize(2); M5.lcd.setTextColor(GREEN); M5.Lcd.printf("Hello World!"); // Relay relay.Init(1); } void loop() { relay.relayAll(1); relay.ledAll(1); delay(2500); relay.relayAll(0); relay.ledAll(0); }
Any reason as to why this wouldn't work? The device is plugged into Port A on the M5Core2. Additionally, using wire scan, I am able to detect the device successfully on the I2C bus. I based my code off of this:
Additionally, this is the specific module I am using:
https://shop.m5stack.com/products/4-relay-unit
Thanks in advance!