so i'm working on wireless transmission, I also already made a post on stackexchange (relay - Wireless data transmission between Seeeduino v.3 and Arduino using RF_2530a ver.11 - Stack Overflow), but i'm still getting the problem.
my goal is : for example when i seeeduino receive pin 4 HIGH, it'll print the value and also turn on relay1 led
and my problem is : when seeeduino receive pin 4 HIGH, the relay1 led didnt turn on at all
can somebody tell me , what I'm missing, any advice would be a great help, thankyou
can somebody tell me , what I'm missing
Yes, indeed, I can. You are missing code.
@PaulS sorry for the post before
Let me make this more clear, So here's what I've had:
- UartSBee v4
- RF2530(maybe known as CC2530)
- Arduino
- 2-channel relay shield
- Seeeduino v3
So I have RF2530 attached to my relay shield, and relay shield attached to the arduino
And I have RF2530 attached to UartSBee, and I have Seeeduino attached to UartSBee by using jumper wire
Seeeduino v3 ------- UartSBee
Rx----------------------Tx
Tx----------------------Rx
3v3---------------------VCC
GND-------------------GND
Seeeduino will receive a GPIO pin from another device, lets say RPi, for example if the RPi send pin number 4 HIGH, the Seeeduino will receive and print "something". When seeeduino print "something" , the arduino board will read what the value it print, and then do something about it.
Here's the code for the Seeeduino(receive the GPIO pin from another device)
const int relay1 = 4;
const int relay2 = 5;
void setup(){
Serial.begin(57600);
pinMode(relay1, INPUT);
pinMode(relay2, INPUT);
}
void loop(){
if(digitalRead(relay1) == 1){
Serial.println("M9"); //indicate relay1 high
}
if(digitalRead(relay1) == 0){
Serial.println("MA"); //indicate relay1 low
}
if(digitalRead(relay1) == 1){
Serial.println("MB"); //indicate relay2 high
}
if(digitalRead(relay1) == 0){
Serial.println("MC"); //indicate relay2 low
}
}
Here's the code for Arduino(Will notice what the value from Seeeduino print, and turn on/off RELAY LED)
#define RELAY1 4 //Relay1 to port 4
#define RELAY2 5 //Relay2 to port 5
int incomingByte = 0;
int M9;
int MA;
void setup(){
Serial.begin(57600);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
}
void loop(){
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.print("I received: ");
Serial.println(incomingByte,DEC);
}
if(M9 == incomingByte){
digitalWrite(RELAY1, HIGH); //turn on Relay1 LED
}
if(MA == incomingByte){
digitalWrite(RELAY1,LOW); //turn off Relay1 LED
}
}
So what my goal is : when the Seeeduino receive pin 4 HIGH, it'll print M9 value, and the arduino will notice it, read the value and turn on Relay1 LED (if arduino read MA value, it'll turn off the Relay1 LED)
And my problem is : i have the problem of reading value from seeeduino, and also turning on/off the led by reading the value
Can anyone tell me what I'm missing , any advice would be helpful, and im sorry if this question kinda weird, thankyou