Statements and comments
Setup and Loop
Loop
Functions
Variables
Integers and floats
True/False
Characters and Strings
Character classification
Split a string and convert it to numbers
Datatype conversion
Variable scope
Arrays
Vectors
Bidimensional arrays
Passing an array to a function
Iteration
Iterate through digital outputs
Iterate through digital inputs
Conditionals
Logical operators
Increment/Decrement
Operator precedence
Modulo
Sine and Cosine
Random
LED blink
LED blink sequence
LED swing
7 Segment led numerical LED display
Optocoupler: 4N35
120-240 VAC Light bulb: TRIAC
MOSFET: IRLD024
LED Port
Switch (button)
Multiple switches
Hall effect sensor
distance (proximity) sensor: Parallax ping
Transmissive optical sensor
Shift Register: 74LS595
Magnetic field sensor: micromag 3-axis
Humidity & Temperature: Sparkfun SHT15
Humidity & Temperature: Parallax SHT11
RGB LED matrix: Sparkfun RGB LED backpack
Potentiometer
Photoresistor
Force Resistor
Air quality sensor: MQ135
Infrared ranger (distance/presence): SHARP GP2D12/120
PiezoFilm (touch/vibration): MSIUSA piezo film
Phototransistor
Microphone (sound sensor)
Ambient light sensor: Sparkfun TEMT6000
Accelerometer: Sparkfun
Air pressure: Motorola
Infrared ranger & LEDs
Potentiometer & LED
LED light intensity
RGB LED
Motor speed
Stretch sensor & LEDs
Light sensor & LED
Attending external interrupts
Timer
LED blink w/timer
This example is for Wiring version 0024+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know .
Random.
Each time the program is loaded the result is different.
int num;
void setup()
{
Serial.begin(9600);
randomSeed(200);
}
void loop()
{
num = random(255); // generate a random number between 0 and 255
Serial.print(num, DEC);
Serial.print(" ");
}