Arduino Uno 3

ArduinoUno3

Arduino Uno 3 is the most popular plateform for begineers in field of robotics.

It contains ATmega328 controller which already have some bootloader and can interract with UART directly.

At Digital-13 is a GPIO (General purpose input output) pin where one LED is placed which is an outputĀ device. You can use this as an output device.

Simple code for this LED blinking is following:

//*************************
//Author: Kumar Satyam
//Date: 24 June 2016
//Code No: KS1000
//Purpose: Blinking LED13
//*************************

//pinNumber 13 is connected to onboard LED
const int pinNumber = 13;

void setup() {
// put your setup code here, to run once:
pinMode(pinNumber, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(pinNumber, HIGH);
delay(1000);
digitalWrite(pinNumber, LOW);
delay(1000);
}

 

If you wish to glow individual LED controlled by ADC0:

//*************************
//Author: Kumar Satyam
//Date: 23 August 2016
//Code No: KS1002
//Purpose: ADC to Individual LED (optimized)
//*************************

const int analogPin = A0;
const int n1=200;
const int n2=400;
const int n3=600;
const int n4=800;
const int n5=1000;
int x=0;
//static int x=0;

void setup() {
for (int i=0; i<=5; i++)
pinMode(i, OUTPUT);
}

void loop()
{
int sensorReading = analogRead(analogPin);

if (sensorReading < n1) x=0;
else if (sensorReading > n1 && sensorReading < n2) x=1;
else if (sensorReading > n2 && sensorReading < n3) x=2;
else if (sensorReading > n3 && sensorReading < n4) x=3;
else if (sensorReading > n4 && sensorReading < n5) x=4;
else if (sensorReading > n5) x=5;

for (int i=0; i<=5; i++)
{
if (i==x)
digitalWrite(i, HIGH);
else
digitalWrite(i, LOW);
}

}

Next codes will be updated soon…arduino-uno-schematic