Upcoming SlideShare
×

# Function( )

86 views

Published on

A basic presentation to help understand concept of Function in terms of programming and especially in Arduino environment.

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
86
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
1
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Function( )

1. 1. Function( ) Riken Patel Hardware Prototyping Workshop [10-13 Feb, 2014] IDC, IIT Bombay
2. 2. make_tea( *le number of cup ) { Take * glass of milk Add * spoon tea-leaf …… … Function Makes our task easy Template to do certain task }
3. 3. make_tea(2) { Take 2 glass of milk Add 2 spoon tea-leaf …… … Function Makes our task easy Template to do certain task }
4. 4. make_tea(7) { Take 7 glass of milk Add 7 spoon tea-leaf …… … Function Makes our task easy Template to do certain task }
5. 5. make_tea(70) { Take 70 glass of milk Add 70 spoon tea-leaf …… … Function Makes our task easy Template to do certain task }
6. 6. make_tea(777); :) Function Makes our task easy Template to do certain task
7. 7. play(*Game name, *number of players); Function Makes our task easy Template to do certain task
8. 8. play(cards, 5); play(carom, 3); play(chinese_checkers, 2); ……. Function Makes our task easy Template to do certain task …….
9. 9.  Digital I/O  Analog I/O  Time  Math &Trigonometry Functions in Arduino  Interrupts  Communication
10. 10. pinMode(); pinMode(*pin_number, INPUT/OUTPUT);  Configures the specified pin to behave either as an input or an output. Digital I/O
11. 11. digitalRead(); int a=digitalRead(pin)  Reads the value from a specified digital pin, either HIGH or LOW & returns a value. Digital I/O digitalWrite(); digitalWrite(pin,value)  Write a HIGH or a LOW value to a digital pin.
12. 12. analogRead(); int a= analogRead(pin) Reads the value from a specified digital pin, either HIGH or LOW. Analog I/O analogWrite() analogWrite(pin, value) Writes an analog value (0-255 PWM wave) to a pin..
13. 13. delay(); delay(1000); Pauses the program for the amount of time (in miliseconds) Time millis() double a=millis(); Returns the number of milliseconds since the Arduino board began running the current program.
14. 14. int a= min(x, y); min() Maths & Trigonometry sin() max() cos() abs() tan() constrain() map() pow() sqrt()
15. 15. map(value, fromLow, fromHigh, toLow, toHigh) Percentage=map(marks,0,500,0,100); Maths & Trigonometry .
16. 16. interrupts() noInterrupts() attachInterrupt() detachInterrupt() Interrupts
17. 17. Serial() Communication