VerifyScans your code and reports any errorsUploadCompiles your code and uploads it to the Arduino board via USBNewOpens a blank Arduino sketchOpenOpens a list of your saved sketches in the file browserSaveSaves your current sketchSerial MonitorOpens the serial monitor in a new windowArduino Program Structurevoid setup() { }Runs once at startupvoid loop() { }Runs continuallyBuilt in Arduino FunctionsPin setuppinMode(PIN_NUMBER, INPUT/OUTPUT)Sets the pin at the location PIN_NUMBER to be either an INPUT or an OUTPUTpinMode(PIN_NUMBER, INPUT_PULLUP)Sets the pin at the location PIN_NUMBER to be an input using the Arduino board’s built-in pull-up resistordigitalRead(PIN_NUMBER)Reads the input at PIN_NUMBER and returns a 1 or 0 (HIGH or LOW)digitalWrite(PIN_NUMBER, VALUE)Writes a value of 1 or 0 (HIGH or LOW) to digital pin PIN_NUMBERanalogRead(PIN_NUMBER)Reads the analog pin PIN_NUMBER and returns an integer between 0 and 1023analogWrite(PIN_NUMBER, VALUE)Emulates analog output VALUE using PWM on PIN_NUMBER (note: only available on pins 3, 5, 6, 9, 10, and 11)analogReference(DEFAULT)Use the default reference voltage (5V or 3.3V depending on board voltage)analogReference(INTERNAL)Use an internal reference voltage (1.1v for ATmega168/328p, 2.56 for ATmega 32U4/8)analogReference(EXTERNAL)Use a voltage applied to the AREF pin as voltage reference (note: 0-5V only)Time functionsmillis()Returns the time in milliseconds since the Arduino sketch began running as an unsigned long integermicros()Returns the time in microseconds since the Arduino sketch began running as an unsigned long integerdelay(INTEGER)Delays program execution for INTEGER millisecondsdelayMicroseconds(INTEGER)Delays program execution for INTEGER microsecondsMathematical Functionsmin(i, j)Returns the lowest of the two values i and jmax(i,j)Returns the highest of the two values i and jabs(i)Returns the absolute value of isin(angle)Returns the sine of an angle in radianscos(angle)Returns the cosine of an angle in radianstan(angle)Returns the tangent of an angle in radianssqrt(i)Returns the square root of ipow(base, exponent)Raises the number base to the number exponent (e.g pow (2 , 3) ==8)constrain(i, minval, maxval)Contrains the value i between minval and maxvalmap(val, fromL, fromH, toL, toH)Remaps val from one range to anotherrandom(i)Returns a random long integer smaller than irandom(i, j)Returns a random long integer between i and jrandomSeed(k)Uses the value k to seed the random() functionCasting(type)variableCasts the value of variable to a new typeSerial CommunicationSerial.begin(speed)Start serial communication at a specified speedSerial.end()Close serial communicationSerial.print(DATA)Prints DATA to the serial port. DATA can be characters, strings, integers and floating point numbersSerial.available()Return the number of characters available to read in the serial bufferSerial.read()Read the first character in the serial buffer (returns -1 if no data is available)Serial.write(DATA)Write DATA to the serial buffer. DATA can be a character, integer, or arraySerial.flush()Clears the serial buffer once outgoing communication is completeServo (#include the Servo.h tag)Servo myServoCreates the variable myServo of type ServomyServo.attach(PIN_NUMBER)Associated myServo with the pin at location PIN_NUMBERmyServo.write(angle)Writes an angle between 0 and 180 to the servo atached to myServomyServo.writeMicroseconds(uS)Writes a value in microseconds to the servo attached to myServo (typically between 1000 and 2000 with 1500 as the midpoint)myServo.read()Returns an integer containing the current angle of the servo between 0 – 180myServo.attached()Returns true if the servo is attached to a pinmyServo.detach()Dissasociates myServo with an attached pinmyServo.detach()Dissasociates myServo with an attached pin





Original Content

Website Source

LEAVE A REPLY

Please enter your comment!
Please enter your name here