Goto considered harmful constants high low input

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
goto // considered harmful :-) Constants HIGH | LOW INPUT | OUTPUT true | false 143 // Decimal number 0173 // Octal number 0b 11011111 // Binary 0 x 7B // Hex number 7 U // Force unsigned 10 L // Force long 15 UL // Force long unsigned 10.0 // Forces floating point 2.4 e 5 // 240000 Data Types void boolean (0, 1, false, true) char (e.g. ‘a’ -128 to 127) unsigned char (0 to 255) byte (0 to 255) int (-32,768 to 32,767) unsigned int (0 to 65535) word (0 to 65535) long (-2,147,483,648 to 2,147,483,647) unsigned long (0 to 4,294,967,295) float (-3.4028235E+38 to 3.4028235E+38) double (currently same as float) sizeof (myint) // returns 2 bytes Strings char S1[15]; char S2[8]={'a','r','d','u','i','n','o'}; char S3[8]={'a','r','d','u','i','n','o','\0'}; //Included \0 null termination char S4[ ] = "arduino"; char S5[8] = "arduino"; char S6[15] = "arduino"; Arrays int myInts[6]; int myPins[] = {2, 4, 8, 3, 6}; int mySensVals[6] = {2, 4, -8, 3, 2}; Conversion char () byte () int () word () long () float () Qualifiers static // persists between calls volatile // use RAM (nice for ISR) const // make read-only PROGMEM // use flash Digital I/O pinMode (pin, [INPUT,OUTPUT]) digitalWrite (pin, value) int digitalRead (pin) //Write High to inputs to use pull-up res Analog I/O analogReference ([DEFAULT,INTERNA L,EXTERNAL]) int analogRead (pin) //Call twice if switching pins from high Z source. analogWrite (pin, value) // PWM Advanced I/O tone (pin, freqhz) tone (pin, freqhz ,duration_ms) noTone (pin) shiftOut (dataPin, clockPin, [MSBFIRST,LSBFIRST], value) unsigned long pulseIn (pin, [HIGH,LOW]) Time unsigned long millis () // 50 days overflow.
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern