In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Arduino built-in tutorial
The built-in example is sketches (separate scripts and programs are called "sketches"), which are included in Arduino IDE and open them to click on the tools menu: File > Examples. These simple programs demonstrate all the basic Arduino commands. They span all areas, from an absolute minimum of Sketch to digital and analog IO, to the use of sensors and displays.
1. Basic principles
Analog read Serial Port: read a potentiometer and print its status to the Arduino serial port monitor. Minimalist framework: you need to start a minimalist code framework for Arduino programming. Flashing: keep turning on and off a LED light. Digital read Serial Port: read a switch and print its status to the Arduino serial port monitor. Gradient: use an analog output to dim the brightness of an LED light. Read analog voltage: read an analog input and print its voltage value to the serial monitor.
two。 Figures
Do not use delay flicker: do not use the delay () function to flash a LED light button: use a button to control a LED light anti-shake: read a button. Then filter out the noise digital input pull-up: use pinMode () to declare the output pull-up reconnaissance state change: calculate the number of keystrokes pressed tone keyboard: a three-key music keyboard using pressure sensors and piezoelectric speakers tone melody: play a melody multiple tones with pressure speakers: use the tone () command to make multiple speakers produce treble follow: determine the tone of the pressure loudspeaker according to an analog input
3. Simulation
Analog input / output serial port: read an analog input pin, return the result, and then use this data to dim or brighten the LED lamp analog input: use a voltmeter to control the flicker of the LED lamp to write Mega: use the Arduino Mega development board to make 12 LED lights one after another, gradually brighten and then darken the calibration: for values beyond the range of the analog sensor Define a maximum and minimum gradient: use an analog output pin (PWM pin) to fade a LED lamp. Make smooth: make the reading values of multiple analog pins smooth
4. communication
ASCIITable (ASCII form): use Arduino's advanced serial port output function. Dimmer: move the mouse to change the brightness of the LED light chart: send data to the computer, and then draw its chart in Processing. Midi (Musical instrument Digital Interface): continuously send MIDI note information to multiple serial ports Mega: enable 2 serial ports on Arduino Mega. Physical pixels: turn LED on and off by sending data from Processing or Max/MSP to Arduino. Read ASCII string: analyze a comma-separated string in an integer to fade a LED lamp. Serial call response: send multiple variables serial call response ASCII through a call-response method (handshake): send multiple variables through a call-response method (handshake) and decode (ASCII) these values before transmission. SerialEvent: use the SerialEvent () function visual color mixer: send multiple variables from Arduino to your computer, and then read the data on Processing or Max/MSP
5. Control structure
Array: a variable in the For loop illustrates how to use an array, arduino. For loop: control multiple LED lights If declaration conditions through the for loop: use a'if declaration'to change the output condition by changing the input condition Switch Case: how to choose among discontiguous values. Switch Case 2: the second switch-case example shows how to take different behavior While declaration conditions according to the characters received on the serial port: how to calibrate a sensor with a while loop when a key is read.
6. Sensor
ADXL3xx: read an ADXL3xx accelerometer Knock: use a piezoelectric element to detect percussion Memsic2125: 2-axis accelerometer Ping: detect objects through an ultrasonic rangefinder
7. Display
Bar chart: make a LED bar chart column scan: control an 8 × 8 LED matrix
8. String
Character Analysis: use operators to identify the corresponding feature types. String Addition Operator: add strings together in different ways. String Append Operator: add something to the string using the + = operator and the concat () method, which is made by the Arduino development board. String Case Changes: change the state of a string. String Characters: get or set the value of a specified character in a string String Comparison Operators: compare strings in alphabetical order String Constructors: initialize the string object String Index Of: find the status of the first or last character in the string String Length & String Length Trim: get and trim the length of the string String Replace: replace individual characters in the string String Start With Ends With: check a given The beginning or end of a character or substring (substrings) StringSubstring-look for "phrases" StringToInt in a given string-allows you to convert a string to an integer number
9.USB
Keyboard logout: use the keystroke command to log out the current user keyboard to send a message: when a key is pressed, send a text string. Keyboard recompilation: open a new window on Arduino IDE and recompile the Leonardo keyboard serial port with a simple × × lamp program: read a byte from the serial port and return a key value. Keyboard and mouse control: demonstrate mouse and keyboard commands mouse button control in a program: control cursor action through 5 keys: mouse joystick control: when keys are pressed, use a joystick to control the movement of the computer cursor
10. Starter kit
11.Arduino ISP
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.