Differences
This shows you the differences between two versions of the page.
— |
blocks:app-note:arduino-encoder [2023-08-16 13:04] (current) mattias created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Connecting an Arduino microcontroller to Blocks ====== | ||
+ | |||
+ | This application note provides an example of how an [[https:// | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | You need a computer with a running Blocks server and a web browser to use this application note. You also need a separate computer running PIXILAB Player. Here is the [[LINK_TO_BlocksrootZIP|Blocks root]] for this application note, and here is the [[LINK_TO_encoderex.zip|Arduino sketch]] (the Arduino sketch has been tested on an Arduino Nano Every). See the [[blocks: | ||
+ | |||
+ | ===== Running the example ===== | ||
+ | |||
+ | - Open the downloaded Arduino sketch in the Arduino IDE. The Arduino sketch depends on the [[https:// | ||
+ | - Upload the sketch to the Arduino. | ||
+ | - Connect the encoder to digital pins 2 and 3 on the Arduino. | ||
+ | - Connect the Arduino to a computer running PIXILAB Player. | ||
+ | - Start Blocks. | ||
+ | - Open the editor using the Admin button. | ||
+ | - Log in using the name //admin// and the password //pixi//. | ||
+ | - Assign the PIXILAB Player to the // | ||
+ | - Rotate the encoder and observe how the bar shown on the PIXILAB Player Spot moves. The speed depends on the resolution of the encoder. Click the "Set to 0" button to reset the encoder position to 0. | ||
+ | |||
+ | ===== Behind the scenes ===== | ||
+ | |||
+ | The PIXILAB Player Spot passes data received from the Arduino to the Blocks server over the network. The // | ||
+ | |||
+ | The source code for the EncoderExample driver is located in PIXILAB-Blocks-root/ | ||