.rotary
DESCRIPTION
Returns the direction of the rotary.
There are 3 different states for the rotary to be: not moving, moving forward and moving backward.
SYNTAX
lcd.rotary();
PARAMETERS
none
RETURNS
A byte with a value from 0 to 2
if returns a 0, the rotary did not move
if 1 the rotary moved forward
if 2 the rotary moved backward
EXAMPLE
#include
#include
InvIoT_U1 lcd(A0, A1); void setup() { lcd.createCustomChars(); //and clears screen lcd.print("Turn Rotary"); } int i = 0; void loop() { int rotaryTurnStatus = lcd.rotary(); if (rotaryTurnStatus == ROTARY_FORWARD) { i++; displayInfoOnLCD("GOING FORWARD"); } if (rotaryTurnStatus == ROTARY_BACKWARD) { i--; displayInfoOnLCD("GOING BACKWARD"); } } void displayInfoOnLCD(String st) { lcd.clear(); lcd.print(st); lcd.printCursor(2, 3, "i = "); lcd.printBig(7, 2, String(i)); delay(20); }
SEE ALSO
.swTop
.swBottom
.swRotary
.rotaryClick