25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 From Robot Wiki Contents 1 Introduction 2 Getting Started with Arduino 3 Tutorial 3.1 1.Blinking a LED 3.2 2.SOS Beacon 3.3 3.Traffic Light 3.4 4.Fading Light 3.5 5.RGB LED 3.6 6.Alarm 3.7 7.Temperature Alarm 3.8 8.Detecting vibration 3.9 9.Ambient Light controlled LED 3.10 10.Moving a Servo 3.11 11.Interact with Servo 3.12 12.RGB Light Dimmer 3.13 13.Motor Fan 3.14 14.Infrared controlled DFRduino Beginner Kit For Arduino (SKU:DFR0100) Light 3.15 15.Intrared controlled LED Matrix 4 Old Version Introduction Welcome to the electronic interaction world! DFRobot proudly presents the Arduino beginner kit for those who are interested in learning about Arduino. Starting from basic LED control to more advanced IR remote control, this kit will guide you through the world of microcontrollers and physical computing. A DFRduino UNO R3 (Compatible with Arduino Uno), the most stable and commonly used Arduino processor, together with DFRobot's best selling prototype shield are included in this kit. http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 1/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki Getting Started with Arduino Introduction (http://arduino.cc/en/Guide/Introduction): What Arduino is and why you'd want to use it. Installation: Stepbystep instructions for setting up the Arduino software and connecting it to an Arduino Uno. Windows (http://arduino.cc/en/Guide/Windows) Mac OS X (http://arduino.cc/en/Guide/MacOSX) Environment (http://arduino.cc/en/Guide/Environment): Description of the Arduino development environment and how to change the default language. Libraries (http://arduino.cc/en/Guide/Libraries): Using and installing Arduino libraries. Tutorial 1.Blinking a LED # Description: # Turns on an LED on for one second, then off for one second, repeatedly. ledPin = 10; void setup() { pinMode(ledPin, OUTPUT); void loop() { digitalWrite(ledPin,HIGH); delay(1000); http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 2/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki digitalWrite(ledPin,LOW); delay(1000); 2.SOS Beacon The connection diagram is the same with Blinknig a LED tutorial. # Description: # Send SOS Beacon by led ledPin = 10; void setup() { pinMode(ledPin, OUTPUT); void loop() { // S(...) three dot for(int x=0;x<3;x++){ digitalWrite(ledPin,HIGH); delay(150); digitalWrite(ledPin,LOW); delay(100); } delay(100); // O(‐‐‐) three dash for(int x=0;x<3;x++){ digitalWrite(ledPin,HIGH); delay(400); digitalWrite(ledPin,LOW); delay(100); } ...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki delay(100); } delay(5000); 3.Traffic Light Traffic Light This code copied from the book Beginning‐Arduino. carRed = 12; //assign the car lights carYellow = 11; carGreen = 10; button = 9; //button pin pedRed = 8; //assign the pedestrian lights pedGreen = 7; crossTime =5000; //time for pedestrian to cross unsigned long changeTime;//time since button pressed void setup() { pinMode(carRed, OUTPUT); http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 4/23...
Page 5
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki pinMode(carYellow, OUTPUT); pinMode(carGreen, OUTPUT); pinMode(pedRed, OUTPUT); pinMode(pedGreen, OUTPUT); pinMode(button, INPUT); digitalWrite(carGreen, HIGH); //turn on the green lights digitalWrite(pedRed, HIGH); void loop() { int state = digitalRead(button); //check if button is pressed and it is over 5 seconds since last button press if(state == HIGH && (millis() ‐ changeTime)> 5000){ //call the function to change the lights changeLights(); } void changeLights() { digitalWrite(carGreen, LOW); //green off digitalWrite(carYellow, HIGH); //yellow on delay(2000); //wait 2 seconds digitalWrite(carYellow, LOW); //yellow off digitalWrite(carRed, HIGH); //red on delay(1000); //wait 1 second till its safe digitalWrite(pedRed, LOW); //ped red off digitalWrite(pedGreen, HIGH); //ped green on delay(crossTime); //wait for preset time period ...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki delay(1000); digitalWrite(carYellow, LOW); //yellow off digitalWrite(carGreen, HIGH); changeTime = millis(); //record the time since last change of lights //then return to the main program loop 4.Fading Light The connection diagram is the same with Blinknig a LED tutorial. Fading Light This example shows how to fade an LED on pin 10 using the analogWrite() function. ledPin = 10; // the pin that the LED is attached to void setup() { // declare pin 9 to be an output: pinMode(ledPin,OUTPUT); // initialize serial communication at 9600 bits per second: Serial.begin(9600); void loop(){ fadeOn(1000,5); fadeOff(1000,5); void fadeOn(unsigned int time,int increament){ //change the brightness by FOR statement for (byte value = 0 ; value < 255; value+=increament){ // print out the value:...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki void fadeOff(unsigned int time,int decreament){ //change the brightness by FOR statement for (byte value = 255; value >0; value‐=decreament){ Serial.println(value); analogWrite(ledPin, value); delay(time/(255/5)); } 5.RGB LED RGB LED redPin = 9; // the pin that the red LED is attached to greenPin = 10; // the pin that the green LED is attached to bluePin = 11; // the pin that the blue LED is attached to void setup(){ pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); void loop(){ http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 7/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki // call the function to change the colors of LED randomly. colorRGB(random(0,255),random(0,255),random(0,255)); //R:0‐255 G:0‐255 B:0‐255 delay(1000); void colorRGB(int red, int green, int blue){ analogWrite(redPin,constrain(red,0,255)); analogWrite(greenPin,constrain(green,0,255)); analogWrite(bluePin,constrain(blue,0,255)); 6.Alarm Alarm float sinVal; toneVal; void setup(){ pinMode(8, OUTPUT); void loop(){ for(int x=0; x<180; x++){ // convert degrees to radians then obtain value http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 8/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki sinVal = (sin(x*(3.1412/180))); // generate a frequency from the sin value toneVal = 2000+(int(sinVal*1000)); tone(8, toneVal); delay(2); } 7.Temperature Alarm Temperature Alarm float sinVal; toneVal; unsigned long tepTimer ; void setup(){ pinMode(8, OUTPUT); Serial.begin(9600); void loop(){ int val; double data; val=analogRead(0); http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 9/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki data = (double) val * (5/10.24); // convert the voltage to temperture if(data>27){ // If the temperture is over 27 degree, buzzer will alarm. for(int x=0; x<180; x++){ sinVal = (sin(x*(3.1412/180))); toneVal = 2000+(int(sinVal*1000)); tone(8, toneVal); delay(2); } } else { // If the temperturn is below 27 degree, buzzer will not alarm noTone(8); } if(millis() ‐ tepTimer > 500){ // output the temperture value per 500ms tepTimer = millis(); Serial.print("temperature: "); Serial.print(data); Serial.println("C"); } 8.Detecting vibration http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 10/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki Ambient Light controlled LED LED = 13; //Led pin val = 0; void setup(){ pinMode(LED,OUTPUT); Serial.begin(9600); void loop(){ val = analogRead(0); // read voltage value Serial.println(val); if(val<1000){ // if the value is less than 1000,LED turns off digitalWrite(LED,LOW); }else{ // if the value is more than 1000,LED turns on digitalWrite(LED,HIGH); } delay(10); 10.Moving a Servo http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 12/23...
Page 13
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki // Moving a Servo // by BARRAGAN <http://barraganstudio.com> // This example code is in the public domain. #include <Servo.h> Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created pos = 0; // variable to store the servo position void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object void loop() { for(pos = 0; pos < 180; pos += 1){ // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for(pos = 180; pos>=1; pos‐=1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 13/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki 11.Interact with Servo Interact with Servo Controlling a servo position using a potentiometer (variable resistor) by Michal Rinott <http://people.interaction‐ivrea.it/m.rinott> #include <Servo.h> Servo myservo; // create servo object to control a servo potpin = 0; // analog pin used to connect the potentiometer val; // variable to read the value from the analog pin void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo.write(val); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 14/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki int val1 = map(potRed,0,1023,0,255); int val2 = map(potGreen,0,1023,0,255); int val3 = map(potBlue,0,1023,0,255); Serial.print("Red:"); Serial.print(val1); Serial.print("Green:"); Serial.print(val2); Serial.print("Blue:"); Serial.println(val3); colorRGB(val1,val2,val3); void colorRGB(int red, int green, int blue){ analogWrite(redPin,constrain(red,0,255)); analogWrite(greenPin,constrain(green,0,255)); analogWrite(bluePin,constrain(blue,0,255)); 13.Motor Fan Motor Fan http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 16/23...
Page 17
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki buttonPin = 2; // button pin ‐‐ Digital 2 relayPin = 3; // relay pin ‐‐ Digital 3 relayState = HIGH; buttonState; lastButtonState = LOW; long lastDebounceTime = 0; long debounceDelay = 50; void setup() { pinMode(buttonPin, INPUT); pinMode(relayPin, OUTPUT); digitalWrite(relayPin, relayState); void loop() { // read the state of the switch into a local variable: int reading = digitalRead(buttonPin); // check to see if you just pressed the button // (i.e. the input went from LOW to HIGH), and you've waited // long enough since the last press to ignore any noise: ...
Page 18
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki digitalWrite(relayPin, relayState); // save the reading. Next time through the loop, // it'll be the lastButtonState: lastButtonState = reading; 14.Infrared controlled Light http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 18/23...
25/06/2015 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki Serial.println(currentNumber); break; } } Serial.println(results.value, HEX); irrecv.resume(); } Old Version V2 wiki (http://www.dfrobot.com/wiki/index.php?title=DFRduino_Beginner_Kit_For_Arduino_(SKU:DFR0100)) V2 tutorial (http://www.dfrobot.com/wiki/index.php?title=Tutorial) Go Shopping Beginner Kit For Arduino v3.0(SKU:DFR0100) (http://www.dfrobot.com/index.php? route=product/product&filter_name=dfr0100&product_id=345#.U7EqtfmSw8o) Retrieved from "https://www.dfrobot.com/wiki/index.php? title=DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100&oldid=26889" Categories: Product Manual DFR Series This page was last modified on 30 June 2014, at 09:23. This page has been accessed 11,112 times. http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 23/23...
Need help?
Do you have a question about the DFR0100 and is the answer not in the manual?
Questions and answers