Date post: | 22-Mar-2017 |
Category: |
Engineering |
Upload: | mebin-p-m |
View: | 961 times |
Download: | 13 times |
Program Code :// LED connected to Pin 13 (Common)
int led = 13;
// setup routine runs once when you press reset:
void setup() {
pinMode(led, OUTPUT); //initialize of digital pin for output.
}
void loop() { // loop routine (infinite loop)
digitalWrite(led, HIGH); // turn on LED
delay(1000); // wait for a 1000ms
digitalWrite(led, LOW); // turn the off LED
delay(1000); // wait for a second
}
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pinsLiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
// defines pins numbersconst int trigPin = 9;const int echoPin = 10;// defines variableslong duration;int distance;void setup() {pinMode(trigPin, OUTPUT); // Sets the trigPin as an OutputpinMode(echoPin, INPUT); // Sets the echoPin as an InputSerial.begin(9600); // Starts the serial communication}void loop() {// Clears the trigPindigitalWrite(trigPin, LOW);delayMicroseconds(2);// Sets the trigPin on HIGH state for 10 micro secondsdigitalWrite(trigPin, HIGH);delayMicroseconds(10);digitalWrite(trigPin, LOW);// Reads the echoPin, returns the sound wave travel time in microsecondsduration = pulseIn(echoPin, HIGH);// Calculating the distancedistance= duration*0.034/2;// Prints the distance on the Serial MonitorSerial.print("Distance: ");Serial.println(distance);}
Serial.write
void setup(){
Serial.begin(9600); }
void loop(){
Serial.write(45);
int = Serial.write
}
Serial.read
Serial.available
int incomingByte = 0;
void setup() {
Serial.begin(9600);}
void loop() {
if (Serial.available() > 0) {}
Act
Sense
Think
Speech, Vision
Acceleration,
Temperature
Position ,Distance
Touch, Force
Magnetic field ,Light
Sound ,Position Sense
Task planning
Plan
Classification
Learn
Process data
Path planning
Motion planning
Output information
Move, Speech to
Text, Wheels,
Legs,Arms,Tracks