
MagicCode Lesson 3
Arduino extension
.
Arduino Blocks
The block sets the digital state of the specified digital pin to either “High” or “Low”. If the output is High, the pin will be at 5V and if the output is Low the pin will be at 0V.
The block set PWM output on Arduino PWM pins. The user can select the output from a range of 0 to 255. If the PWM output is 128, then half the time output will be high and for the rest, the output will be Low.
The block rotates the servo connected to the selected PWM pin on Arduino with the selected angle(0,45,90,135,180) in degrees.
The block reads the state of the digital pin on Arduino (“High” or “Low”). If the state of the pin is “High”, it returns True, else False.
The block returns the value of analog pins available in the connected hardware between the value range 0 to 1023. This range is mapped to the voltage of the pin (normally 0 to 5V). If the value received is 512, the voltage value will be around 2.5V.
The block Re-maps a number from one range to another. According to the default values mention in this block, 50 in the range 0-1023 mapped to the nearest integer value between the range 0-255 which is 12.