4in1 Arduino Tutorial 2
4in1 Arduino Tutorial 2
ELECTRONICS-PROGRAMMING-ROBOTICS
▪ Week 1 – Electronics
▪ Week 2 – Programming
▪ Week 3 – Arduino
▪ Week 4 – Robotics
1. Synchronization bits - These are the start and stop bits transferred with each chunk of data. They let the
receiver know that data is coming and when it has finished transmitting.
2. Data bits - This is the actual information we send, can be 5-9 bits long.
3. Parity bits - Parity bits are determined using odd or even logic after adding each 1 from the data chunk. It is a
method of error checking that slows your data transfer and you will need a method to resend incorrect dat
4. Baud rate - the baud rate is the speed at which both devices agree to send and receive data at. Think of this as a
clock signal that you sent and forget. It is measured in bits per second.
//Variables:
int value; //save analog value
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(potPin, INPUT); //Optional
void loop(){
value = analogRead(potPin); //Read and save analog value from potentiometer
value = map(value, 0, 1023, 0, 255); //Map value 0-1023 to 0-255 (PWM)
analogWrite(ledPin, value); //Send PWM value to led
delay(100); //Small delay