Mixly Block Category - In / Out

From Microduino Wiki
Revision as of 19:53, 9 February 2017 by Sonny (talk) (Analog Write)
Jump to: navigation, search

Digital Pin State

When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: HIGH and LOW.

HIGH

  • A pin is read as HIGH if the voltage on that pin is greater than a certain voltage value (3.0V or 2.0V).
  • A pin is set to the maximum operating voltage (5V or 3.3V) when HIGH is written.

LOW

  • A pin is read as LOW if the voltage on that pin is less than a certain voltage value (1.5V or 1.0V).
  • A pin is set to the minimum voltage (0V) when LOW is written.

Further reading here (section Defining Pin Levels: HIGH and LOW): https://www.arduino.cc/en/Reference/Constants

Digital Pin Operations

Digital Write

Write a HIGH or a LOW value to a digital pin.

Further reading here: https://www.arduino.cc/en/Reference/digitalWrite

Digital Read

Reads the value from a specified digital pin, either HIGH or LOW.

Further reading here: https://www.arduino.cc/en/Reference/digitalRead

Analog Pin Operations

NOTE: Not all pins are capable of analog mode. Analog pins are denoted with the prefix A. i.e. A0, A1, A2 are analog pins.

Analog Write

Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analog write the pin will generate a steady square wave of the specified duty cycle until the next call to analog write (or a call to digital read or digital write on the same pin).

The value X between 0 and 255 will output the (X/255) * Maximum Voltage (5V/3.3V) on the pin.

Further reading here: https://www.arduino.cc/en/Reference/analogWrite

Analog Read

Reads the value from the specified analog pin. Returns a value between 0 and 1023. The return value is a map of input voltage (0V to 5V/3.3V) to a value between 0 and 1023.

Further reading here: https://www.arduino.cc/en/Reference/analogRead

Interrupts

Attach Interrupt

Detach Interrupt

Pulse In

Shift Out

External links