(SKU:RB-01C030)CarDuino Leonardo

From ALSRobot-Wki
Jump to: navigation, search


Carduino Leonardo01.jpg

Contents

Product introduction

Carduino Leonardo is a fully compatible with the Arduino Leonardo of USB interface based on open source Simple I/O interface board (including 22 channel digital GPIO, 7 channel PWM output, 12 channel 10 bit ADC input channels), and have used a similar Java IDE integrated development environment, C language. Allows you to quickly use the Arduino language and Flash or Processing software, such as interactive work. < br / >

Carduino can use developed electronic components such as Switch sensors or other controller, LED, stepper motor or other output device. Also can be used as a keyboard, mouse input device, etc. Carduino Leonardo can also become a can operate independently and software interface of the ditch, for example: Flash Processing Max/MSP VVVV or other interactive software. Arduino IDE interface based on open source code, allows you to free download to use to develop more amazing works of interaction.

Arduino basic technical parameters

1. controller: ATmega32u4
2. Working frequency: 16 MHz
3. Working voltage: 5V
4. input voltage (recommended): 7-12V
5. Digital I/o port: 22 (D0~D13,D14-MISO,D15-SCK,D16-MOSI,D18~23[A0~A5])
6. PWM channel: 7(D3,D5,D6,D9,D10,D11,D13)
7. analog input: 12(A0~A5,D4-A6,D6-A7,D8-A8,D9-A9,D10-A10,D12-A11)
8. 5 v digital/analog maximum allowable current: 40 mA
9. 3.3 V digital/analog maximum allowable current: 50 mA
10. Flash Memory: 32 KB (ATmega32u4) of which 4 KB used by bootloader
11. SRAM: 2.5 KB (ATmega32u4)
12. EEPROM: 1 KB (ATmega32u4)

Arduino download software and development environment

1,Software download
Please download the arduino1.01 or above
official software download address:http://arduino.cc/en/Main/Software
2,Software and hardware driver installation
This software is a green version of the software can be used after decompression.
Extract the software download address:
http://jaist.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920.exe
Software decompression is completed, the next to install CrduinoLeonardo hardware driver.
Will Crduino Leonardo lag on the MiNi USB connection, the other side of the USB connection to any USB interface.

Carduino Leonardo02.jpg

The next system will appear the Arduino Leonardo Windows Update driver installation.

Carduino Leonardo03.jpg

But it also cannot find the driver in Windows Update.

Carduino Leonardo04.jpg

At this time we need to manually install the driver, open "control panel" under the "device manager"

Carduino Leonardo05.jpg

At this time will appear in other devices with an exclamation point of Arduino Leonardo equipment. On the icon on the right click select "update driver software"

Carduino Leonardo06.jpg

In "how do you want to search for driver software" select "browse computer for driver software"

Carduino Leonardo07.jpg

Then choose your Arduino IDE extract software to find Drivers drive folder click next

Carduino Leonardo08.jpg

At this time there will be a Windows cannot verify this driver software publishers warning

Carduino Leonardo09.jpg
Carduino Leonardo10.jpg

After the installation is complete in the "port (COM and LPT)" next to generate a new port I COM3 is generated here

Carduino Leonardo11.jpg

3,Arduino compile download software instructions Open the software simply double-click the execution arduino. An.exe file, you can see the following program compiled window. Starting from the Arduino1.0 already support Chinese interface. Specific modification method motor under "file" - "parameter setting".

Carduino Leonardo12.jpg

Need to choose the number plate in front of the input program, and the COM COM slogan is we just drive on COM3. In the "tools" - "Serial Port" option.

Carduino Leonardo13.jpg

And then select the type of location in the "tools" - "Board:" - "Arduino Leonardo".

Carduino Leonardo14.jpg

The basic set can write programs. First of all, we open a flash routines. Location in the "file" - "sample" - "01. Basic" - "Blink".

Carduino Leonardo15.jpg

Click (figure) program can be compiled, check whether there are grammar mistakes. Click on the (figure) to download the program to CarduinoLeonardo. Download success will display in the status bar pane "download"

Carduino Leonardo16.jpg

At this time will find Carduino Leonardo destroy a second light flashing.
If needed and Arduino click on serial communication, communication monitoring window (figure), you can see the following dialog.

Carduino Leonardo17.jpg

Arduino summary of basic language

Arduino to use more comprehensible than other microprocessors, similar to some Basic Stamp, programming language is more simple and humanization of the Arduino, Arduino programming language based on C language, C language but its practicability is much higher, mainly because it will be some commonly used sentences combination function, such as: delay time delay function (1000) for a second.

Arduino program basic architecture

(1)Declare variables and the interface name(int val; int ledPin=13;)。
(2)setup()——Function at the beginning of the program to use, can initialize a variable, interface mode, enable the library (for example: pinMode (ledPin, OUTUPT);) .
(3)loop()——After the setup () function, namely after the initialization, the loop () to make your program loop is executed, use it to run the Arduino.

Arduino commonly used programming languages

(1)PinMode (name of interface, the OUTPUT or INPUT) - the interface is defined as INPUT or OUTPUT interface, used in the setup () function.
(2)DigitalWrite (name of the interface, HIGH or LOW) - will be digital interface value to HIGH or LOW.
(3)DigitalRead (interface name) - read the value of digital interface.
(4)AnalogWrite (interface name, number) - writing simulation values to an interface (PWM wave). For Arduino ATmega168 chips (including Mini or BT), the function can work in 3,5,6,9,10 and 11 interface. Original ATmega8 chip USB and serial Arduino support only 9, 10 and 11 interface.
(5)AnalogRead (interface name) - the value read from the specified analog interface, the Arduino the simulation value is 10 - bit digital conversion, this method converts 0-5 input voltage value to an integer value between 0 and 1023.
(6)Delay () - delay for a period of time, delay (1000) for a second.
(7)Serial. The begin (baud rate) - set Serial transmission data rate (baud rate) per second. On the same computer communication, use the following value: 300120 0240 0480 0960 0144 00192 00288 00384 00576 or 00576. You can also use other values at any time, for example, with 0 or 1 socket communication requires special baud rate. In the setup () function
(8)Serial.read()——Read the last of the input data.
(9)Serial. Print (data, data base), the output data to the Serial port. Serial. Print (data). Defaults to a decimal is equal to the Serial print (data, DEC).
(10)Serial. Println (data, data base), the output data to the Serial port, followed by a carriage return and a a newline character. The function of the value and Serial. Print ().

Using Carduino Leonardo mouse application

1、Need equipment:
1) Arduino sensor expansion board

Carduino Leonardo18.jpg

Interface diagram is as follows:

Carduino Leonardo19.jpg

2)Press type button module

Carduino Leonardo20.jpg

3)Biaxial buttons rocker

Carduino Leonardo21.jpg

4) 3 pin sensor cable
Two 3 pin sensor cable

Carduino Leonardo22.jpg

5)Dupont line
Two dupont line

Carduino Leonardo23.jpg

2,Hardware connection:
Put the sensor expansion board Carduino Leonardo, the Button with 3 pin cable received number 2 on the mouth as startup and shutdown of the mouse function keys, the Joystick on B (Button) to the number 3 mouth, X (X) received simulation 0, Y (Y) received simulation 1 mouth.

Carduino Leonardo24.jpg

3,Routine source code:

const int switchPin = 2; // switch to turn on and off mouse control 
const int mouseButton = 3; // input pin for the mouse pushButton 
const int xAxis = A0; // joystick X axis 
const int yAxis = A1; // joystick Y axis 
const int ledPin = 5; // Mouse control LED 
// parameters for reading the joystick: 
int range = 12; // output range of X or Y movement 
int responseDelay = 5; // response delay of the mouse, in ms 
int threshold = range/4; // resting threshold 
int center = range/2; // resting position value 
boolean mouseIsActive = false; // whether or not to control the mouse 
int lastSwitchState = LOW; // previous switch state 
void setup() { 
pinMode(switchPin, INPUT); // the switch pin 
pinMode(ledPin, OUTPUT); // the LED pin 
// take control of the mouse: 
Mouse.begin(); 
} 
void loop() { 
// read the switch: 
int switchState = digitalRead(switchPin); 
// if it's changed and it's high, toggle the mouse state: 
if (switchState != lastSwitchState) { 
if (switchState == HIGH) { 
mouseIsActive = !mouseIsActive; 
// turn on LED to indicate mouse state: 
digitalWrite(ledPin, mouseIsActive); 
} 
} 
lastSwitchState = switchState;// save switch state for next comparison: 
// read and scale the two axes: 
int xReading = readAxis(A0); 
int yReading = readAxis(A1); 
// if the mouse control state is active, move the mouse: 
if (mouseIsActive) { 
Mouse.move(xReading, yReading, 0); 
} 
// read the mouse button and click or not click: 
// if the mouse button is pressed: 
if (digitalRead(mouseButton) == HIGH) { 
// if the mouse is not pressed, press it: 
if (!Mouse.isPressed(MOUSE_LEFT)) { 
Mouse.press(MOUSE_LEFT); 
} 
} 
// else the mouse button is not pressed: 
else { 
// if the mouse is pressed, release it: 
if (Mouse.isPressed(MOUSE_LEFT)) { 
Mouse.release(MOUSE_LEFT); 
} 
} 
delay(responseDelay); 
} 
int readAxis(int thisAxis) { 
// read the analog input: 
int reading = analogRead(thisAxis); 
// map the reading from the analog input range to the output range: 
reading = map(reading, 0, 1023, 0, range); 
// if the output reading is outside from the 
// rest position threshold, use it: 
int distance = reading - center; 
if (abs(distance) < threshold) { 
distance = 0; 
} 
return distance;// return the distance for this axis 
} 

Products related to recommend

Buy address:Carduino Leonardo

Personal tools
Namespaces

Variants
Actions
Navigation
Tools