0% found this document useful (0 votes)
5 views1 page

Programming Note

The document provides a programming reference for digital and analog input/output, serial communications, control structures, general operators, and data types. It includes syntax examples for functions such as pinMode, digitalWrite, and analogRead, as well as control flow statements like if-else and for loops. Additionally, it outlines various data types and their ranges.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Programming Note

The document provides a programming reference for digital and analog input/output, serial communications, control structures, general operators, and data types. It includes syntax examples for functions such as pinMode, digitalWrite, and analogRead, as well as control flow statements like if-else and for loops. Additionally, it outlines various data types and their ranges.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

APPENDIX I - PROGRAMMING REFERENCE

MINIMUM SKETCH DIGITAL INPUT/OUTPUT


void setup( ) pinMode ( pin, INPUT/OUTPUT );
{ } // run once:
void loop( ) digitalWrite ( pin, HIGH,LOW );
{ } // run repeatedly: int = digitalRead ( pin );

SERIAL COMMUNICATIONS ANALOG INPUT/OUTPUT

pinMode ( pin,OUTPUT );
[Link] ( baudrate );
analogWrite ( pin, 0-255 );
[Link] ( );
[Link] ( “ “ ); //text
int = analogRead ( pin );

CONTROL STRUCTURE RANDOM, MAPPING, TONE

if ( condition ) { Action A } random(min, max);


else
{ Action B } map(val, fromL, fromH, toL, toH);

for (int i=0; i <= 255; i++) tone(pin, freqhz ,duration_ms);


{ } noTone(pin);

GENERAL OPERATORS DATA TYPES

= (assignment operator) int (-32,768 to 32,767)


+ (addition) - (subtraction) unsigned int (0 to 65535)
* (multiplication) / (division) oat (-3.4028235E+38 to
% (modulo) 3.4028235E+38)
== (equal to) != (not equal to) double (currently same as oat)
< (less than) > (greater than) boolean (0, 1, false, true)
<= (less than or equal to) char (e.g. ‘a’ -128 to 127)
>= (greater than or equal to) byte (0 to 255)
&& (and) || (or) ! (not)

106

You might also like