pages
home
compiler
code compiler
electronics
notes about electronics
laboratory
laboratory
Processing
Processing code compiler
Theremino
Theremino code compiler
logggin
accedi o esci
tutorials Arduino
lights
my first led turns on
led's games
an electronic dice
traffic lights
candle effect
fading effect
red-green-blue 1
red-green-blue 2
7-segment display - Countdown
7-segment display bis
sensors
sensors
Sensor and serial port
sensor PIR
ultrasonic sensor
sound
Theremin
a melody
build a note
switches
buttons
keypad
input via serial port
input via serial port 2
input remote control
input remote control 2
use of variables
custom functions
servos
a robot
a remote-controlled robot
elettronica
mechanics
Italian
handbook
pins
connections
resistors
remarkable sketches
remarkable circuits
Arduino pins
error messages
tables
colour's tables
electrical simbols
referenze on-line
reference Arduino
reference Processing
link
www.arduino.cc
fritzing.org/projects
processing.org
links
hardware
base kit
facilitated kits
advanced kits
Theremino
begins the workshop
review a workshop carried out
my account
info
link
contacts
myfunctions
introduction
A function is a block of code that will be executed when "someone" calls it:
program
apri il programma
inizia il laboratorio
algorithm
attrezzaggio
pin3˜
_RGBblue
pin5˜
_RGBgreen
pin6˜
_RGBred
variabili
ciclo
call the function:
eyes_color
INPUT
0
0
255
eyes_color
con
3
input
MODULATION
_RGBred
to the value:
eyes_color_X1
MODULATION
_RGBgreen
to the value:
eyes_color_X2
MODULATION
_RGBblue
to the value:
eyes_color_X3
Arduino code
//programma: myfunctions //******* pin ******** //******* declare ******** const int pin_RGBblue=3;//pin of _RGBblue const int pin_RGBgreen=5;//pin of _RGBgreen const int pin_RGBred=6;//pin of _RGBred //********** setup ********** void setup(){ pinMode(pin_RGBblue,OUTPUT); pinMode(pin_RGBgreen,OUTPUT); pinMode(pin_RGBred,OUTPUT); } //********** loop ********** void loop() { eyes_color(0,0,255); };//end loop //********** my functions ********** declares a new function void function eyes_color(eyes_color_X1,eyes_color_X2,eyes_color_X3){ analogWrite(pin_RGBred,eyes_color_X1); analogWrite(pin_RGBgreen,eyes_color_X2); analogWrite(pin_RGBblue,eyes_color_X3); } //powered by "Arduinomio" (C) //www.mastrohora.it
copy/past in Arduino
electrical connections
here Fritzing's file
logout
Ultima modifica: Agosto 2016