Now, we learn about an open source electronic prototyping platform that allows us to create interactive electronic objects.
There are several Arduino versions available that can be purchased, preassembled, or do-it-yourself kits. Arduino can interact with the environment by receiving input from a variety of digital and analog sensors, and can produce and trigger actions to affect its surroundings by controlling lights, motors, and other actuators using its analog and digital outputs.
You need the basic knowledge in electronics. For more information, visit http://www.arduino.cc.
Then, you will need the following:
Let's now see the steps involved in preparing an Arduino board.
sketch.pde
(downloaded ZIP file) into Arduino ROM using Arduino IDE application.Arduino installation's live image following the previous schema:
comMG.au3
, arduino.au3
, and commg.dll
, and paste them into your script folder.conecta(3,9600)
to match your Arduino port in case you get a different port on connection.;Example 1 digital input (Press button): #include <arduino.au3> conecta(3,9600) While 1 $sbutton = digitalread(2) If $sbutton = 1 Then MsgBox(0,"","button pressed") Sleep(50) WEnd
;Example 2 analogic input (Light Sensor): #include <arduino.au3> conecta(3,9600) $initial = analogread(7) $initial -= 50 While 1 $ldr = analogread(7) If $ldr < $initial Then MsgBox(0,"","Less light") Sleep(50) WEnd
;Example 3 digital output (Switch lights on/of): #include <arduino.au3> MsgBox(0,"Light Output Autoit", "Enter to blink") conecta(3,9600) While 1 digitalwrite(11,1) ; On Sleep(1000) digitalwrite(11,0) ; Off Sleep(1000) WEnd
;Example 4 analogic output (Color Lights): #include <arduino.au3> conecta(3,9600) While 1 $r = InputBox("Red Light","Value between 0-255") $g = InputBox("Green Light","Value between 0-255") $b = InputBox("Blue Light","Value between 0-255") analogwrite(11,$r) analogwrite(12,$g) analogwrite(13,$b) WEnd
The arduino.au3
library includes some basic functions to enable Arduino analog read/write, digital read/write in a simple way. AutoIt codes have not been compiled with cross-compiler, but it works interactively using an Arduino to Autolt port for electronic management. You write the program in your Windows computer, and you run it from Windows. Then, the Autolt port sends/receives messages from Arduino. So, you must be connected to a Windows PC for establishing a connection. See photos.
arduino.au3
functions read button press, temperature, read digital sensors, or maybe even read a GPS signal. You can create your own Arduino sketches.
You can use it for outputs, to move servos, motors, lights, and switches.
Arduino has several connectors as analog/digital outputs/inputs:
For example, consider an LDR (Light Depending Resistor). We generated a resistance that decreases voltage as a function of the surrounding light, it measures light voltage variation. Arduino will get/return a value between 0 and 1024. 0 is 0V and 1024 is 5V.