#include SoftwareSerial mySerial(11, 2); // RX, TX int motor = 1; // pin to which LED is attached int botton = A2; // analog pin to which potentiometer is attached void setup() { pinMode(motor, OUTPUT); //sent the pin as an output pinMode(botton,INPUT_PULLUP) } void loop() { mySerial.begin(9600); //start the serial software comunication value = analogRead(pot); // reads the value of potentiometer (ranging from 0 and 1023) mySerial.print("sensor = "); //message mySerial.print(value); //message outputValue = map(value, 0, 1023, 0, 255); // scale it to use it with analogWrite analogWrite(motor, outputValue); // set the analog out value // print the results to the Serial Monitor: mySerial.print("\t output = "); mySerial.println(outputValue); delay(2); // wait for 2 milliseconds for // analog-to-digital converter to settle }