Led Arduino to arduino

Hello all quick question I was wondering if someone could point me in the direction to get an led to dim on one arduino via another arduino

in the end i want one arduino with a pot to control another one with led via xbee but right now i just want to test to see if its possible thank you

Analog read the pot. Map reading to 0-255. Send mapped reading to other arduino. Other arduino: analog write (PWM) received value to LED pin.

thank you so much not my question is does this look right on the send side

// These constants won't change. They're used to give names // to the pins used: const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the pot int outputValue = 0; // value output to the PWM (analog out)

void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); }

void loop() { // read the analog in value: sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(sensorValue, 0, 1023, 0, 255); // change the analog out value: analogWrite(analogOutPin, outputValue);

// print the results to the serial monitor:


// wait 2 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(30); }

and on the receive side of things is

int ledPin = 9; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor void setup() {

Serial.begin(9600); pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT


void loop() {

if (Serial.available()) { sensorValue = Serial.read(); analogWrite(ledPin, sensorValue);

} delay(30); }

How are you connecting the two Arduinos together?

in time i want to use xbees but right now i have the tx and rx pins connected

jonesen269: in time i want to use xbees but right now i have the tx and rx pins connected

You'll also need to connect the grounds together.