Arduino Starter Kit
Arduino Starter Kit
Introduction
The kit uses the Freaduino UNO, which is the improved version of the official UNO and
100% compatible with Arduino. It provides easy-to-use brick sensor interface, 3.3v or 5v IO
switch, power supply with DCDC circuit which support MAX 2A etc.
/*
PART1 ARDUINO START Blink
Turns on LED for one second, then off for one second,
repeatedly.
Get the code from: Arduino IDE-
>File->Example->Basics->Blink
Pin 13 has an LED connected on most Arduino boards.
*/
void setup() {
// the loop routine runs over and over again forever: void loop() {
} </syntaxhighlight>
/*
PART2 BUTTON CONTROL LED
Press the button, led ON, press again
led OFF */
int led = 5; // The D5 pin,driving LED int button = A0; // The A0,read the button,Here
used a analog pin as digital pin. void setup() {
pinMode(led, OUTPUT); // initialize the
LED pin
as an output.
pinMode(button, INPUT_PULLUP);// initialize the BUTTON
pin as an input.
} void loop() {
if(digitalRead(button)==LOW){
delay(200); // wait for 200 microsecond,Avoid
pressing the button and read many times in this very
short time
digitalWrite(led, HIGH); // turn the LED on (HIGH is
the voltage level)
while(1){
if(digitalRead(button)==LOW){
delay(200);
digitalWrite(led, LOW); // turn the LED off
(LOW is
</syntaxhighlight>
Part3. Vibration sensor control passive buzzer
<syntaxhighlight lang="php">
/*
PART3 Vibration sensors CONTROL Passive buzzer
Knock on the table, the buzzer will ring
*/
int vibration = A0;// The A0 pin,read Vibration sensors int buzzer = 6; // The D6 pin,driving
the Passive buzzer,the pin must PWM pin(3 5 6 9 10 11 on UNO)
void setup() {
} void loop() {
if(digitalRead(vibration)==HIGH){ analogWrite(buzzer,2
00); //driver Passive buzzer must
PWM,so analogWrite,200 is PWM value,max 1024
</syntaxhighlight>
/*
PART4 PIR Sensor CONTROL Motor fan
If someone passing from the front, the fan
will turn */
int pir = A0; // The A0 pin,read PIR int motor = 6; // The 6 pin,driving the motor
void setup() {
} void loop() {
if(digitalRead(pir)==HIGH){ digitalWrite(m
otor,HIGH); delay(5000);// wait for 5000
microsecond
digitalWrite(motor,LOW); //turn off the motor
}
}
</syntaxhighlight>
/*
PART5 Photodiode sensor CONTROL Motor Fan
According to the intensity of light motor
speed control */
int photodiode= A0; // The A0 pin,read Photodiode int motor = 6; // The 6 pin,driving the
motor
void setup() {
pinMode(photodiode,INPUT);// initialize the photodiode
pin as an input.
pinMode(motor,OUTPUT); // initialize the motor pin as
an output.
void loop() {
</syntaxhighlight>
/*
PART6 Soil moisture Sensor CONTROL Relay
According to the intensity of light motor
speed control */
int soil= A0; // The A0 pin,read Soil moisture int relay = 6; // The 6 pin,driving the Relay
void setup() {
} void loop() {
int value=analogRead(soil);
if(value>200){//set the default value ,you can set it
then more or less to do something
digitalWrite(relay,HIGH);//turn on the relay
}
else digitalWrite(relay,LOW);//turn off the relay
</syntaxhighlight>
Part7. Encoder sensor control servo
<syntaxhighlight lang="php">
/*
PART7 Encode Sensor CONTROL Servos
Turn the rotary encoder control servos
*/
1. include <Servo.h>
int encodeB= A0; // The A0 pin,read encodeB int servos = 6; // The 6 pin,driving the
servos Servo servo; //Get a servo controller int angle=90; //set the servo angle void
setup() {
if(digitalRead(encodeB)==HIGH){
angle-=30;
}else angle+=30;
if(angle>=180)angle=180;
else if(angle<=0)angle=0;
servo.write(angle); }
</syntaxhighlight>
tm1637.display(2,(dht11.DHT11data)[2]%10);
tm1637.display(1,(dht11.DHT11data)[2]%100/10); delay(1000); tm1637.clearDisplay();
tm1637.display(3,(dht11.DHT11data)[0]%10); // humidity
tm1637.display(2,(dht11.DHT11data)[0]%100/10); delay(1000); }
</syntaxhighlight>
0xFD6897,0xFD18E7, 0xFD9867,0xFD58A7}; // 6 7 8 9
while(!(i>9||result.value==codes[++i]));
if(i<10){
tm1637.clearDisplay();
tm1637.display(3,i);//IRremote value
}}}
</syntaxhighlight>
Download
Download IDE from : Arduino Download
Download Code and Libraries: Arduino Starter Kit Demo Code
How to buy
https://www.elecfreaks.com/arduino-starter-kit-absolute-beginner.html
Licensing
This documentation is licensed under the Creative Commons Attribution-
ShareAlike License 3.0 Source code and libraries are