Submitted by Alan (not verified) on Wed, 03/10/2010 - 02:32.
I have been working on the communication between the two arduino's. The good news is that when the pump is running off a seperate arduino it no longer effects the Irms value. I'm using the following code to send a value from analog 5 on Arduino 1 (Sender) to control the pump on Arduino 2 (Receiver). Now that I have this working I want to replace the value of analog 5 with Irms value (Sender) and control the pump (Receiver), but I am having problems ....again.
//Sender
int analogValue5, val5;
void setup() {
// Serial port enable
Serial.begin(19200);
}
// remap values from the analogValue5 variable to 0 / 255
val5 = map(analogValue5, 0, 1023, 0, 255);
//send the value to the serial port
Serial.println(val5, BYTE);
}
//Receiver
byte incomingByte;
void setup() {
// Serial port enable
Serial.begin(19200);
// declare pin 11 as output, this is the LED
pinMode (11, OUTPUT);
}
void loop() {
// if there is bytes available coming from the serial port
if (Serial.available()) {
// set the values to the ‘incomingByte’ variable
incomingByte = Serial.read();
// write the value to the pin 11
analogWrite(11, int(incomingByte));
}
}
Although I got this code working I cannot get it to work along with your code, for example to send Irms value instead of analog 5 value to control the pump. Sorry for all the questions but I'm a bit of a newbie and now that I got this far I don't want to stop. If you could just give me any advice on how to change this code to work with yours so that I can send the Irms value instead of analog 5 value?
I have been working on the
I have been working on the communication between the two arduino's. The good news is that when the pump is running off a seperate arduino it no longer effects the Irms value. I'm using the following code to send a value from analog 5 on Arduino 1 (Sender) to control the pump on Arduino 2 (Receiver). Now that I have this working I want to replace the value of analog 5 with Irms value (Sender) and control the pump (Receiver), but I am having problems ....again.
//Sender
int analogValue5, val5;
void setup() {
// Serial port enable
Serial.begin(19200);
}
void loop() {
// read analog pin 5
analogValue5 = analogRead(5);
// remap values from the analogValue5 variable to 0 / 255
val5 = map(analogValue5, 0, 1023, 0, 255);
//send the value to the serial port
Serial.println(val5, BYTE);
}
//Receiver
byte incomingByte;
void setup() {
// Serial port enable
Serial.begin(19200);
// declare pin 11 as output, this is the LED
pinMode (11, OUTPUT);
}
void loop() {
// if there is bytes available coming from the serial port
if (Serial.available()) {
// set the values to the ‘incomingByte’ variable
incomingByte = Serial.read();
// write the value to the pin 11
analogWrite(11, int(incomingByte));
}
}
Although I got this code working I cannot get it to work along with your code, for example to send Irms value instead of analog 5 value to control the pump. Sorry for all the questions but I'm a bit of a newbie and now that I got this far I don't want to stop. If you could just give me any advice on how to change this code to work with yours so that I can send the Irms value instead of analog 5 value?
Thanks again for all your help.