Arduino Rotary Encoder Protocol
This protocol controls a rotary encoder connected to the microcontroller. Rotary encoders can turn infinite number of rounds. If the rotary encoder turns or the state of the button on the encoder changes, the device sends an event to the .Net. You can use full, half or quarter rotary encoders.
How to build a test circuit with a rotary encoder and an Arduino Mega?
Arduino codes are included.
I. "Welcome" event from microcontroller
Example
c=welcome&type=OzRotaryController&id=IqlZci&pos=2&t=3
Parameters
Parameter | Type | Range | Functionality |
c | String | "welcome" | Identifies the welcome message. |
type | String | "OzRotaryController" | Determines the type of the device. |
id | String | 6 characters (numbers, uppercase and lowercase characters) | The ID of the device which is chosen by the microcontroller. |
pos | Byte | 0-255 | Determines the position of the device on the list of the ID manager of the microcontroller. Please make sure there are no other devices in the same position. |
t | Byte | 0-255 | Counts the number of events sent combined. Counts from 0 to 255 then from 0 again. |
II. Commands to microcontroller
None
III. Event from microcontroller
"Rotary Changed" event
This event is called if the rotary encoder changes direction or the button is pressed or released.
Example
c=rotarychange&button=1&left=0&right=0&id=IqlZci&t=3
Parameters
Parameter | Type | Range | Functionality |
c | String | "rotarychange" | Identifies the event. |
button | Bool | 0,1 | Button's state (see:OzekiButtonController). |
left | Bool | 0,1 | If rotated left, it changes to 1. It is 0 otherwise. |
right | Bool | 0,1 | If rotated right, it changes to 1. It is 0 otherwise. |
id | String | 6 characters (numbers, uppercase and lowercase characters) | The ID of the device which is chosen by the microcontroller. |
t | Byte | 0-255 | Counts the number of events sent combined. Counts from 0 to 255 then from 0 again. |
Response
This response is sent from your computer.
c=rotarychange_resp&button=1&left=0&right=0&id=IqlZci&t=1
Parameters
Parameter | Type | Range | Functionality |
c | String | "rotarychange_resp" | Identifies the event response. |
button | Bool | 0,1 | Button's state (see:OzekiButtonController). |
left | Bool | 0,1 | If rotated left, it changes to 1. It is 0 otherwise. |
right | Bool | 0,1 | If rotated right, changes to 1. It is 0 otherwise. |
id | String | 6 characters (numbers, uppercase and lowercase characters) | The ID of the device which is chosen by the microcontroller. |
t | Byte | 0-255 | Counts the number of responses sent combined. Counts from 0 to 255 then from 0 again. |
More information
- Protocolo serie del transceptor RF de 433 MHz
- Protocolo serie del joystick analógico
- Protocolo serie del sensor analógico
- Protocolo serie del botón
- Protocolo serie del zumbador
- Protocolo serie del motor de CC
- Protocolo serie del sensor DHT
- Protocolo serie de la EEPROM
- Protocolo serie del teclado
- Protocolo serie del sensor de giróscopo
- Protocolo serie del administrador de ID
- Protocolo serie del transceptor IR
- Protocolo serie de la pantalla LCD
- Protocolo serie del lector NFC
- Protocolo serie de la puerta óptica
- Registro
- Protocolo serie del transceptor RF24
- Protocolo serie del LED RGB
- Protocolo serie del sensor RGB
- Protocolo serie del codificador rotatorio
- Protocolo serie del motor servo
- Protocolo serie del contador de pasos
- Protocolo serie del motor paso a paso
- Protocolo serie del interruptor
- Protocolo serie del sensor de temperatura
- Protocolo serie del temporizador
- Protocolo serie del sensor ultrasónico
- Mensajes de bienvenida de la impresora 3D Ozeki