Sunday, April 3, 2016

Arduino Micro controller for Robotics Workshop

WORKING WITH ARDUINO BOARD





Me at swecha
ME AT SWECHA


This weekend I've attended the Arduino Opensource Robotic workshop. It was really wonderful.

I met the people who already working on Arduino.
I also saw an obstacle avoiding Robot out of the Arduino.
Swecha is the Indian National Opensource programmers community organized the two days event.









first arduino program
First program with Arduino

Programming

The software can be found on arduino.cc .
It is free software, we can download.
And the hardware is an open hardware

I used the Arduino UNO, but you can use any type of Arduino

First Arduino Program ... Experimenting with LED (RGB combination... many more colors ... one after the Other ).


The program for the RGB sensor is


int redPin = 11;
int greenPin = 10;
int bluePin = 9; 
//uncomment this line if using a Common Anode LED
//#define COMMON_ANODE 
void setup(){  pinMode(redPin, OUTPUT);
 pinMode(greenPin, OUTPUT);
 pinMode(bluePin, OUTPUT);
  }
 void loop()
{  setColor(255, 0, 0);  // red 
 delay(1000);  setColor(0, 255, 0);  // green 
 delay(1000);  setColor(0, 0, 255);  // blue  
delay(1000);  setColor(255, 255, 0);  // yellow  
delay(1000);    setColor(80, 0, 80);  // purple  
delay(1000);  setColor(0, 255, 255);  // aqua  
delay(1000); 
//we can make many more colors by changing the numbers . we can make rainbow colors 
}
 void setColor(i
nt red, int green, int blue)
{  
#ifdef COMMON_ANODE    
red = 255 - red;    
green = 255 - green;    
blue = 255 - blue;  
#endif  analogWrite(redPin, red);  
analogWrite(greenPin, green);  
analogWrite(bluePin, blue);  
}


RGB lights
Working with RGB lights

Then I've written a program for the temperature sensor, (which senses the temperature of the area/room).

program for temperature sensor is :
int val;
int tempPin = 9;
void setup ()
{
Serial.begin(9600);
}

void loop ()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000; 
float cel = mv/10;
float farh = (cel*9)/5 + 32;

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);

Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();


}


I've also written a program for the LDR sensor, (which senses the amount of light present in the area/room).

program for LDR sensor is :


 int sensorPin = 9;
 int sensorValue = 0;
 
 void setup() 
 {
 Serial.begin(9600);
 }
 void loop() 
 {
 sensorValue = analogRead(sensorPin);
 Serial.println(sensorValue);
 delay(100);
 }




No comments:

Post a Comment

Popular Posts