I have x2 apc220 v3.0 and I want to control the brightness of my led with a potentiometer from Arduino to Arduino.
This is my transmitter code:
unsigned int knobValue; //This is the variable we will use to store the buzzers
int potpin = 0;
int ledFade = 11;
void setup()
{
Serial.begin(9600); //APC220's can use the standard Serial communication
pinMode(ledFade, OUTPUT);
}
void loop()
{
knobValue = analogRead(potpin);
knobValue = map(knobValue, 0, 1023, 0, 255);
analogWrite(ledFade, knobValue);
delay(100);
}
This is my receiver code:
unsigned int knobValue; //This is the variable we will use to store the buzzers
int ledFade = 11;
void setup()
{
Serial.begin(9600); //APC220's can use the standard Serial communication
pinMode(ledFade, OUTPUT);
}
void loop()
{
if (Serial.available() > 0) //While there is a serial connection available...
{
knobValue = Serial.read(); //Read the incoming serial data and store it to data
analogWrite(ledFade, knobValue); // change the brightness of the led
}
}
I believe that I made the logic correctly. But I am missing something; because I cannot control my led's brightness with my potentiometer from other arduino.
Please, would you show me where am I missing or doing wrong ? thank you very much.
I am new at this wireless communication and there is not solid tutorial on the internet for using apc220 v3.0 too ( at least the way I want to use ).