ardublock study kit

Download ArduBlocK Study Kit

If you can't read please download the document

Upload: jeanpierre-mendoza

Post on 02-Jan-2016

579 views

Category:

Documents


6 download

TRANSCRIPT

  • ArduBlock graphical programming kit --- For Arduino

    ArduBlock zero base programming package recently launched a Arduino-based graphicalprogramming enthusiasts learning packages, greatly reduces the learning curve for enthusiasts, allprogramming are available through the building-block approach to high-level computer languageand professional grammar, simplified as a module, piled together. Finally, and interactive ArduinoDevelopment Boards to make exciting effect.

    http://keyes-arduino.taobao.com

    fl

  • Arduino open source characteristics, making her support of a large number of fans on the Internet,there have been a lot of learning communities. As ArduBlock are the building blocks ofprogramming, largely reducing the threshold of learners do not need specialized knowledge, noengineering background, as long as you like, you can play. Especially now that the great emphasison training the next generation of people, this is for you and your child one of the best ways toparent-child interaction.

    ArduBlock zero base programming package list:1. Funduino UNO R3 development board * 12 sensor expansion board * 13 white LED module * 14 red LED module * 15 Yellow LED module * 16 Green LED module * 17 buzzer module * 18.LM35 temperature sensor * 19 light sensor * 110 Sound Sensor * 111 rotary potentiometer module * 112 button module * 113 Ultrasonic Ranging Module * 114.XY joystick module * 115.9 g servos * 116.3PIN sensor cable * 517 DuPont lines * 2018.USB cable * 1

    http://keyes-arduino.taobao.com

    fl

  • 1.Arduino microcontroller Introduction

    Arduino is derived from the Italian open source hardware projects a platform that includes a with asimple I / O functions of the circuit board and a set of application development environmentsoftware. Arduino can be used to develop interactive products, such as it can be read by a largenumber of switches and sensor signals, and can control lights, motors, and other kinds of physicaldevices; Arduino can also develop peripheral devices connected to the PC, can on the PC runningthe software to communicate.

    http://keyes-arduino.taobao.com

    fl

  • Arduino-driven installation and programming process:

    The experiment with the development board is Funduino UNO R3 development board, fullycompatible with the official version.See physical map:

    Let's download the Arduino development software, web address: http://arduino.cc/en/Main/SoftwareDownloaded arduino-1.0.zip file is a compressed folder, extract it to your hard drive.

    The Funduino UNO R3 development board via a USB cable to connect to Windows, you will beprompted with named "Arduino UNO R3" New USB device found

    http://keyes-arduino.taobao.com

    fl

  • Then Windows will guide us into the "Found New Hardware Wizard" window, select one of the"No, not this time" and click "Next" button:

    The next step you need to install the required drivers Funduino UNO R3, select one of the "Installfrom a list or specific location (Advanced)" option and click "Next" button:

    Funduino UNO R3 drivers on Arduino 1.0 drivers directory under the installation directory, weneed to specify the directory where you installed Windows when driven search directories:

    Click the "Next" button, Windows will begin to find and install the Arduino drivers:

    If everything is normal, then we will see the following success screen:

    Arduino driver installation is successful, we can in the Windows Device Manager, find the corresponding Arduino serial port:

    ************************************************** ****************************

    http://keyes-arduino.taobao.com

    fl

  • 2.ArduBlock Introduction

    Designed for the Arduino a graphical programming software, created by the Shanghai Newcustomer development workshop. ArduBlock official Arduino programming environment softwareis third-party software, must be attached to the Arduino software currently running, the textdistinguishes Arduino programming environment, ArduBlock is the way to build a graphicalprogramming blocks, in such a way makes visualization and programming Interactivity enhancedprogramming threshold is reduced, even without programming experience can also try to Arduinocontroller programming.

    http://keyes-arduino.taobao.com

    fl

  • On the right is the image programming, left is to generate the C language, if you do not know C language, graphics, you should know it!

    The figure is a flashing led program

    The following analysis of the programMain do -> loop {set a pin high -> Delay 1 second -> Set an output pin low -> Delay 1 second.}If you are a master, please avoid:Graph corresponding C languagevoid setup (){pinMode (1, OUTPUT);}

    void loop (){digitalWrite (1, HIGH);delay (1000);digitalWrite (1, LOW);delay (1000);}

    *******************************************************************************Interest to the bar and immediately installed.Download: http://cloud.github.com/downloads/taweili/ardublock/ardublock-all.jar

    First download, open Arduino1.0, click File, then click Perferences (Figure)

    http://keyes-arduino.taobao.com

    fl

  • We can see the pop-up box, remember the following this path (Figure)

    D: \ My Documents \ Arduino \ tools \ ArduBlockTool \ tool

    Look into your folder there is no such path, if no folder has been created, and then put back archive you downloaded (in fact, JAVA software) replication in the final folder inside the

    http://keyes-arduino.taobao.com

    fl

  • installation is complete.

    Open the Arduino 1.0 development environment, Tools-> ArduBlock This option is (not the original)

    ************************************************** *************************

    That ArduBlock exactly how to use it?ArduBlock modules are divided into different categories."Control" zone is a function of control structures.(1) Control

    http://keyes-arduino.taobao.com

    fl

  • 2.PIN feet

    These modules can be in your Arduino template as a virtual pin.3 numbers, constants and variables

    http://keyes-arduino.taobao.com

    fl

  • 4 op

    This project includes logical and mathematical operations

    5 Common Commands

    http://keyes-arduino.taobao.com

    fl

  • These are commonly used in programming.6 modules

    Each module represents a direct use of hardware, it can be directly used as part of your hardware.

    *******************************************************************************

    3 experimental coursesHere we should Arduino and ArduBlock have a preliminary understanding, we are following through hands-on learning of this graphical programming software.

    http://keyes-arduino.taobao.com

    fl

  • Ardublock zero-based programming routines 1 LED flashes

    experiments

    LED lights are more basic experimental one experiment, we used bright LED light modules tocomplete the experiment.Apparatus as follows:Arduino compatible development board Funduino uno R3 * 1Arduino IO port expansion board V5 * 1Bright LED light module * 13PIN sensor cable * 1

    Small light experiment schematics

    Physical map

    http://keyes-arduino.taobao.com

    fl

  • Good link circuit according to the diagram, you can start writing programs, and we still makeLED lights flashing, lit one second off one second. This procedure is very simple and comes withArduino Blink similar routines where just 13 digital interface for doing 10 digital interface.

    A good job, then click download to ARDUINO, ARDUINO programming interface code will appear************************************************** ***************************void setup (){pinMode (10, OUTPUT);}

    void loop (){digitalWrite (10,! (HIGH));delay (1000);digitalWrite (10,! (LOW));delay (1000);}

    http://keyes-arduino.taobao.com

    fl

  • Then we can see that we have received IO port 10 feet flashing bright LED lamp module, so our little lights flashing experiment is complete.*******************************************************************************Note: Arduino development software choiceTOOLS bar board option is UNO,To select the initial installation of the communications port serial appearsTwo indispensable, or can not download the program.*******************************************************************************

    Ardublock zero-based programming routines 2 PWM Dimming

    PWM (Pulse-width modulation) pulse width modulationPWM is controlled using digital means to a means of the analog output. Using digital controlgenerates different duty cycle square wave (a constant switching between on and off signals) tocontrol the analog outputs. Generally port input voltage is only two 0V and 5V. If I want myoutput voltage of 3V how to do. . . Some students said that the series resistance, right, this methodis correct drops. But if I want to 1V, 3V, 3.5V, and so forth between changes in how to do it?Impossible to keep it switched resistor. In this case. . . You need to use a PWM. How he controlsit, the digital port for arduino LOW and HIGH voltage output only two switches, thecorresponding voltage is 0V and 5V output, we present the LOW is defined as 0, HIGH is definedas 1 to a second arduino 500 outputs a signal of 0 or 1. If this is all for a 500, it is a complete 5V, ifall is 0, that is 0V. If 010101010101 so that the output, just half and half, the output port on thefeeling is the voltage output of 2.5V. This is a screening of the film, and we reason, we have to seethe movie is not completely continuous, it is actually output 25 pictures per second, in this case isthe servant can not be seen to the naked eye, it looks like that is a continuous . PWM is the samereason, if you want different voltages between 0 and 1 on the control of the output of proportionalcontrol is ok ~ course. . . This is true there are still differences of continuous output, output perunit time of 0,1 signal, the more control the more accurate.

    http://keyes-arduino.taobao.com

    fl

  • In the following figure, the green line represents a cycle between, and its value is the reciprocal ofthe PWM frequency. In other words, if the arduino PWM frequency is 500Hz, then the periodbetween two green lines is two milliseconds. analogWrite () command can be controlled in therange of 0-255, analogWrite (255) indicates a 100% duty cycle (normally open), analogWrite(127) duty cycle of about 50% (half the time).

    The experiment is controlled via a PWM LED lights brighten and then slowly let it slowly darken,so the cycle. Similarly, we still put bright LED module to the digital IO port pin 10, the followingis a wiring diagram:

    Let Programming:

    http://keyes-arduino.taobao.com

    fl

  • Similarly, we still click (download to ARDUINO), see the code generated by IDE interface************************************************** **********************int _ABVAR_1_brightness;

    void setup (){_ABVAR_1_brightness = 0;}

    void loop (){while (((_ABVAR_1_brightness) (0))){_ABVAR_1_brightness = (_ABVAR_1_brightness - 1);analogWrite (10, 255 - (_ABVAR_1_brightness));delay (8);}

    delay (200);}*******************************************************************************So the way we use the graphical programming the LED slowly fades as breathing, so we gave it amagical name, breathing light.

    http://keyes-arduino.taobao.com

    fl

  • Ardublock zero-based programming routines 3 traffic lights

    design experiments

    Above we have completed a single small light control experiment, then we do a little morecomplicated traffic light experiments, in fact, clever friends can see out of this experiment is totest a single small light above experiments extended to three colors The small lights, you canachieve our experiment simulated traffic lights. We accomplish this experiment requiredcomponents in addition to Arduino compatible controller and the download cable is also requiredhardware is as follows:Red LED module * 1Yellow LED module * 1Green LED module * 13PIN cable * 3Ready we can start these components, we can follow the above experimental replicability of smalllights flashing, here is that we provide reference schematics, respectively, we use digital 10,7,4,interface.

    http://keyes-arduino.taobao.com

    fl

  • Since it is a traffic light simulation experiments, a small red-yellow-green lights flashing time willsimulate real traffic lights,We use the Arduino delay () function to control the delay time relative to the C language wouldsimply many of the.

    Let Programming:

    http://keyes-arduino.taobao.com

    fl

  • Click (download to ARDUINO), we can see that the IDE appears the following code:

    / / *****************************************************************************void setup (){pinMode (10, OUTPUT);pinMode (4, OUTPUT);pinMode (7, OUTPUT);}

    void loop (){digitalWrite (4, LOW);digitalWrite (7, LOW);digitalWrite (10, HIGH);delay (1000);digitalWrite (4, LOW);digitalWrite (7, HIGH);digitalWrite (10, LOW);delay (200);digitalWrite (4, HIGH);digitalWrite (7, LOW);digitalWrite (10, LOW);delay (1000);}

    }

    / / ******************************************************************************

    http://keyes-arduino.taobao.com

    fl

  • *******************************************************************************Complete the download process can be seen after the traffic control of our own design

    Ardublock zero-based programming routines 4 keys to

    control LED

    Control buttons are a commonly used electrical components, used to turn on or off the circuit, soas to control operation of the motor or other device switch. The experimental use buttons to control the led light or off.The general situation is directly to the key switch in series with the circuit led to the switch, thisapplication is relatively simple.The experiment is controlled by indirect methods, determine the key after key is turned in thecircuit output voltage, if the voltage is greater than 4.88V, the LED on the circuit output is high,and vice versa on the output low. Use logic to determine methods to control the LED light or off,this control method wide range of applications.Components needed to complete this experiment in addition Arduino compatible controller anddownload cable is also required hardware is as follows:White LED module * 1Key module * 13PIN Cable * 2

    http://keyes-arduino.taobao.com

    fl

  • Experimental diagram:

    Let Programming:

    http://keyes-arduino.taobao.com

    fl

  • Click (download to ARDUINO), we can see that the IDE appears the following code:/ / *****************************************************************************void setup (){pinMode (10, OUTPUT);pinMode (4, INPUT);}

    void loop (){if ((digitalRead (4) && HIGH)){digitalWrite (10,! (HIGH));delay (50);}else{digitalWrite (10,! (LOW));delay (50);}}

    ******************************************************************************* *******************************************************************************After the completion of the download process can use the keypad to control LED lights up.

    Ardublock zero-based programming routines 5 buzzer

    http://keyes-arduino.taobao.com

    fl

  • experiments

    Arduino can be done with a lot of interactive work, the most common and most commonly used isthe sound and light show in front has been in use LED lights in the experiment, the experiment leteveryone circuit sound, with a voice The most common is the buzzer and speaker components, thecomparison of the two buzzer easier and ease the present study, we buzzer.The following components are to be prepared:Buzzer module * 13PIN Cable * 1Connection diagram:

    Connect the circuit to the attention of the positive and negative point is that the buzzer of thepoints, can be seen below on the right physical map buzzer red and black two wiring. Connect thecircuit program in this regard is very simple, with small lights front control buttons experimentalprocedure is similar because of the buzzer output control interface Digital interface also cancontrol the high and low buzzer sounds.

    http://keyes-arduino.taobao.com

    fl

  • Let Programming:

    Click (download to ARDUINO), we can see that the IDE appears the following code:

    *****************************

    http://keyes-arduino.taobao.com

    fl

  • ************************************************** ****************************

    After downloading the program, the buzzer experiments are done.

    void setup(){pinMode( 10 , OUTPUT);}

    void loop(){digitalWrite( 10 , HIGH );delay( 1000 );digitalWrite( 10 , LOW );delay( 1000 );digitalWrite( 10 , HIGH );delay( 500 );digitalWrite( 10 , LOW );delay( 500 );}

    http://keyes-arduino.taobao.com

    fl

  • Ardublock zero-based programming routines 6 experimental

    analog value read

    In this study, we have to start learning about analog I / O interface to useArduino with Analog 0 - Analog 5 Total 6 analog interfaces, which six interface can also becounted as multiplexed interface functions, in addition to analog interface functions, which 6 canbe used as a digital interface to use interfaces, numbered numeral 14 - the number 19, simpleunderstanding after following on to start our experiment. Potentiometer is more familiar typicalanalog value output element, the experiment will be done with it.Required components are:Potentiometer module * 13PIN Cable * 1In this study, we will be the resistance of the potentiometer into analog value is read out, and thendisplayed on the screen, which is why we need to complete their subsequent experimental featuresexamples of applications that must be mastered. We need the following diagram to connect thephysical map

    http://keyes-arduino.taobao.com

    fl

  • We are using an analog 0 interface.

    Procedures for the preparation is very simple, a analogRead (); statement can be read out analogport values, Arduino 328 is a 10-bit A / D acquisition, so the read analog value range is 0-1023,the experimental procedure There is also a difficulty value is displayed on the screen this problem,it is very simple to learn. First, we want to voidsetup () which set the baud rate, the indicated valueis Arduino communicate with the PC, so the Arduino software and PC baud rate should be set inthe same order to show the correct value, otherwise it will be garbled or does not appear in thelower right corner of the monitor window of Arduino software has a button that you can set thebaud rate, the baud rate set here need to talk program void setup () which set the baud rate thesame procedure to set the baud rate of the statement is Serial.begin (); includingNo value for the baud rate. The second is a statement of the displayed value, Serial.print (); orSerial.println (); all OK, unlike the latter value End show automatically after carriage return, theformer is not, to explain more about the statement in front of

    Introduced here is not to say more, we have to write the program:

    Click (download to ARDUINO), we can see that the IDE appears the following code:/ / *****************************************************************************void setup (){Serial.begin (9600);}

    http://keyes-arduino.taobao.com

    fl

  • void loop (){Serial.print ("value:");Serial.print (analogRead (A0));Serial.println ("");delay (1000);}

    ************************************************** *********Here is read analog values. This experiment is done here, when you turn the potentiometer knob when you can see thechanges in the value on the screen, read the analog value of this method will always accompanyus, the analog value is read very frequently used functions, as Many sensors are analog valueoutput, we read the analog value, and then the corresponding algorithm processing, can be appliedto the functions we need to implement in the.

    Ardublock zero-based programming routines 7

    experimental sound and light control

    Photoresistor (photovaristor) also known as light-sensitive resistor which is made of the use of thephotovoltaic effect of a resistance value changes with the intensity of incident light resistor;incident light intensity, the resistance decreases, the incident light is weak, the resistor increases.Light sensitive resistor is generally used for measurement, control and photoelectric conversion oflight (the change of the light is converted to electrical change).Photoresistor can be widely used in various light control circuit, such as lighting control,regulation and other occasions, also be used for light control switch.In this experiment we first conduct a relatively simple experiment using photoresistors

    1, the experimental device photoresistor modules: 1 Buzzer Module: 1

    http://keyes-arduino.taobao.com

    fl

  • 3PIN Cable * 2

    2, the experimental connection

    3, the experimental principle

    The application process preceding sections read analog port voltage value method photoresistorconnected directly to the digital port. When there is light, the photosensitive resistor decreases, thebuzzer does not sound. Block photoresistor module, the normal sound,

    Let Programming:

    http://keyes-arduino.taobao.com

    fl

  • Click (download to ARDUINO), we can see that the IDE appears the following code:/ / *****************************************************************************int _ABVAR_1_val;

    void setup (){_ABVAR_1_val = 0;Serial.begin (9600);pinMode (10, OUTPUT);}

    void loop (){_ABVAR_1_val = AnalogRead (A0);Serial.print ("light:");Serial.print (_ABVAR_1_val);Serial.println ("");if (((_ABVAR_1_val)

  • else{digitalWrite (10, LOW);delay (1000);}}

    **************************************************

    Master the program, we can design experiments yourself, you can also use photoresistor controlled lamp brightness.

    http://keyes-arduino.taobao.com

    fl

  • Ardublock zero-based programming routines 8 voice light

    experiment

    Sound sensor is used to ambient sound level in the detection, can be used to detect the intensity ofthe sound and the output voltage is proportional to. Analog sensors only need a dedicated dataline, it can be used with Arduino sensor expansion board combination, very easy to achieve soundperception associated with interactive effects. Operating voltage: +3.3 / 5V, Interface Type:Analog, current:

  • Connect can write programs, and

    Click (download to ARDUINO), we can see that the IDE appears the following code:/ / *****************************************************************************int _ABVAR_1_sound_value;int _ABVAR_2_;

    http://keyes-arduino.taobao.com

    fl

  • void setup (){_ABVAR_1_sound_value = 0;Serial.begin (9600);}

    void loop (){_ABVAR_1_sound_value = 0;for (_ABVAR_2_ = 0; _ABVAR_2_

  • experimentsA position servo servo drive, mainly by the housing, a circuit board, coreless motors, gears and theposition detector of the composition. Its working principle is the microcontroller sends a signal tothe receiver or servos, which has an internal reference circuit, resulting in a period of 20ms, thewidth of 1.5ms reference signal will get the DC bias voltage and the potentiometer voltagecomparator, access differential voltage output. Judgment of the IC via the circuit board thedirection of rotation and then starts rotating non-core motor drive, the power transmitted throughthe reduction gear arm, and back to the signal from the position detector to determine whether thepositioning has been reached. For changing the angle and that require a control system can bemaintained. When the motor speed is constant, the reduction gear driven by cascading rotarypotentiometer so that the voltage difference is 0, the motor stops rotating. General steering angleof rotation range is 0 to 180 degrees.

    There are many standard servos, but all the servos have an external three lines, respectively, withbrown, red, orange and three colors to distinguish, because servos different brands, colors willvary, brown is the ground wire, red for positive power supply line, orange for the signal lines.Angle of rotation of the servo by adjusting the PWM (pulse width modulation) signal duty cycleto be achieved, standard PWM (pulse width modulation) signal period is fixed at 20ms (50Hz), intheory, should be distributed at 1ms pulse width to between 2ms, but, in fact, be 0.5ms to 2.5mspulse width between pulse width and servo corner 0 ~ 180 correspond. It is worth noting theplace, because servos different brands, for the same signal, different brands of servo rotation anglewill be different.

    After understanding the basics since we can learn to control a servo, and this experiment needonly servos a few components, jumpers a bundle on it.RB-412 servos * 1

    http://keyes-arduino.taobao.com

    fl

  • Breadboard Jumper * a tieArduino control with steering in two ways, one is through the Arduino ordinary digital sensorinterface produce different duty cycle square wave, analog servo positioning generate a PWMsignal, the second is the direct use of Arduino comes Servo function steering control, this controlmethod has the advantage of programming, the disadvantage is only control two-way steering,because Arduino own function only use digital 9,10 interface. Arduino drive capability is limited,so when you need to control one or more servos require an external power supply.

    Here we have a module control via potentiometer rotation servosUse Original:arduino board * 1Potentiometer module * 19 g servos * 1Sensor cable * 1

    Here we must be careful not to use the computer usb power supply, because if the current demandis greater than 500ma, usb may be burned, it is recommended to use an external battery powered.

    Let Programming:

    http://keyes-arduino.taobao.com

    fl

  • A good job, then click (download to ARDUINO), ARDUINO programming interface code willappear************************************************** ***************************

    # Include

    int _ABVAR_1_val;int _ABVAR_2_servo;Servo servo_pin_9;

    void setup (){_ABVAR_1_val = 0;servo_pin_9.attach (9);_ABVAR_2_servo = 0;}

    void loop (){_ABVAR_1_val = AnalogRead (A0);_ABVAR_2_servo = Map (_ABVAR_1_val, 0, 1023, 0, 180);servo_pin_9.write (_ABVAR_2_servo);}

    http://keyes-arduino.taobao.com

    fl

  • **************************************************

    Burn development board inside the program, we can use a potentiometer control servos.

    Ardublock zero-based programming routines 10 Ultrasonic

    Ranging

    We look first to understand ultrasonic module

    1, HC-SR04 module performance is stable, measure the distance accurately, is the highest pricethe market ultrasonic module, the module can be realized 2cm-4.5m non-contact distance

    http://keyes-arduino.taobao.com

    fl

  • measurement capabilities, with 2.4-5.5V wide voltage input range, static consumes less than 2mA,comes with a temperature sensor for correction ranging results, but also has GPIO, serial, andother means of communication, which with the watchdog, stable and reliable.

    2, the main technical parameters: 1) Use voltage: DC5V 2) Static current: less than 2mA 3) level output: high-5V Low 0V 4) Serial output: 9600 baud, 1 start bit, 1 stop bit, 8 data bits, no parity, no flow control. 5) Sensor angle: not more than 15 degrees 6) Detection distance: 2cm-450cm 7) Precision: 0.3cm +1% 8) board size 20 * 45 * 1.6mm

    3 Wiring: VCC, trig (control side) / TXD, echo / RXD (receiving end), GND.

    4 Usage: 10US a control population made a high of more than, you can wait to receive high outputport. A timer can be opened with the output timing, when this port goes low when you can readtiming The value of this time on time for this distance, only calculate the distance. This constantcycle of measurement, you can reach the value of the mobile measurement ~ ~

    5 Module works:Only need Trig / TX pin input a high of more than 10US, the system may issue 8 40KHZultrasonic pulse, and then detect the echo signal. When the echo signal is detected, the modulealso for temperature measurement, and then the ranging result of the current temperaturecorrection, the corrected results by Echo / RX pin output. In this mode, the module into thedistance value is 340m / s when the time value of 2 times, a high level side output by Echo,according to the duration of this high value to calculate the distance. Ie, the distance values are:(High Time * 340m / s) / 2. Note: Because the distance value temperature correction has been, atthis time no longer according to the ambient temperature on the ultrasonic sound velocitycorrection, that no matter how much the temperature, velocity selection 340m / s can be.

    Let's experiment, first press the figure's identity, the ultrasonic connected to ARDUINO,

    http://keyes-arduino.taobao.com

    fl

  • Connect Well, we started programming:

    Look real connection diagram

    http://keyes-arduino.taobao.com

    fl

  • A good job, then click download to ARDUINO, ARDUINO programming interface code willappear************************************************** ***************************

    int ardublockUltrasonicSensorCodeAutoGeneratedReturnCM (int trigPin, int echoPin){ int duration; pinMode (trigPin, OUTPUT); pinMode (echoPin, INPUT); digitalWrite (trigPin, LOW); delayMicroseconds (2); digitalWrite (trigPin, HIGH); delayMicroseconds (5); digitalWrite (trigPin, LOW); duration = pulseIn (echoPin, HIGH); duration = duration / 59; return duration;}

    int _ABVAR_1_t1;

    void setup (){Serial.begin (9600);digitalWrite (4, LOW);

    _ABVAR_1_t1 = 0;}

    void loop (){_ABVAR_1_t1 = ArdublockUltrasonicSensorCodeAutoGeneratedReturnCM (4, 5);Serial.print ("distance:");Serial.print (_ABVAR_1_t1);Serial.println ("");delay (1000);}

    http://keyes-arduino.taobao.com

    fl

  • ************************************************** ***************************Download a good program we can see in ARDUINO serial surveillance ultrasonic distancemeasurement values Ultrasound can be clearly felt by hand block value changes

    Well, this section is on here, we can use your imagination, the ultrasound is applied to other designgo above.

    Ardublock zero-based programming routines 11 PS2 joystick

    module

    http://keyes-arduino.taobao.com

    fl

  • First, the product descriptionThe company produces PS2 game joystick axis sensor module consists of using original qualitymetal PS2 joystick potentiometer systemFor, with (X, Y) 2-axis analog output, (Z) 1 digital output channel button. With Arduino sensorexpansion board can be madeFor remote control and other interactive work. In addition the product in order to allow customersto more easily fit arduino expansion boards and other standard interfacesMouth, in the design of the X, Y, Z-axis circuit leads individually, you can use three pinARDUINO dedicated line directly into the expansion board for use. It is convenient.

    Second, product characteristicsIt is like a game console joystick, you can control the joystick module input x, y, z ofValues, and to achieve a particular value in a function, it can be considered a combination ofbuttons and a potentiometer. DataType of x, y dimension for the analog input signal is a digital input signal z dimension, therefore,x and y connected to the analog portPin sensor end, and z port is connected to the digital port.

    Third, the useOn how to use, we first look at how it works now, so we know it is there in the endHow, which we find it helpful to use, there is a functional diagram below, we take a lookNow we should clear it, in fact, it is a potentiometer Well, x, y dimension of the data output isanalogPort readout voltage value, is not a little surprised. Of course, this is not shown above, z-dimensional data output, in fact, it is moreSimple, we know that z-dimensional output only 0 and 1, then it can be achieved through a buttonbar. Now on we shouldSurface of saying, it is a potentiometer and button combination (To be honest, if you do notunderstand it just to see thatSentence is a bit foggy it? ).

    After reading the chart I believe we all know how to use it right Arduino, x, y dimension wereceived two analog portsRead their values, z dimension we are to the digital port, and so on the line, plus the power andground, so fine. . . .

    http://keyes-arduino.taobao.com

    fl

  • Joystick Module 1Here x I connected an analog port 0, y even an analog port 1,

    Even a good circuit, now we come Programming:

    Fourth, the module testLet's look at this test what things we have, in fact, not much. . . .Arduino controller 1USB data cable 1

    http://keyes-arduino.taobao.com

    fl

  • A good job, then click download to ARDUINO, ARDUINO programming interface code willappear************************************************** ***************************int _ABVAR_2_y;int _ABVAR_1_x;

    void setup (){_ABVAR_2_y = 0;Serial.begin (9600);_ABVAR_1_x = 0;}

    void loop (){_ABVAR_1_x = AnalogRead (A0);_ABVAR_2_y = AnalogRead (A1);Serial.print ("x:");Serial.print (_ABVAR_1_x);Serial.println ("");Serial.print ("y:");Serial.print (_ABVAR_2_y);Serial.println ("");delay (500);}

    ************************************************** ****************************Download a good program we can see in ARDUINO serial surveillance joystick module X-axisand Y-axis values

    Fourth, the module testLet's look at this test what things we have, in fact, not much. . . .Arduino controller 1USB data cable 1

    http://keyes-arduino.taobao.com

    fl

  • The introduction of the game joystick module on to this, in fact, use it to make a pretty good thing,we can enjoy theImagination.

    Ardublock zero-based programming routines 12 LM35

    temperature sensor experiment

    LM35 is a very common and easy to use temperature sensor element, the components need onlyone application LM35 components, using only an analog interface can be, on the difficulty lies inthe algorithm will read the analog value is converted to the actual temperature.Connect the circuit according to the following diagram.

    Hand shake joystick module X-axis and Y-axis, we can clearly see that the number of changes

    http://keyes-arduino.taobao.com

    fl

  • Let Programming:

    A good job, then click download to ARDUINO, ARDUINO programming interface code will appear************************************************** ***************************int _ABVAR_2_dat;

    http://keyes-arduino.taobao.com

    fl

  • int _ABVAR_1_val;

    void setup (){_ABVAR_2_dat = 0;_ABVAR_1_val = 0;Serial.begin (9600);}

    void loop (){_ABVAR_1_val = AnalogRead (A0);_ABVAR_2_dat = ((5 * _ABVAR_1_val) / 10);Serial.print ("TEMP =");Serial.print (_ABVAR_2_dat);Serial.println ("");delay (100);}

    **************************************************Download a good program we can see the current ARDUINO serial monitor the temperature ofthe

    Above is our finishing Ardublock zero-based programming 12 routines, of course, there are manyapplications ARDUINO, we hope to learn communication************************************************** ****************************

    http://keyes-arduino.taobao.com

    fl