Nav Wheel JIGMOD
This Nav Wheel JIGMOD allows you to easily integrate a rotating selector and button to your circuit with ease.
- rotating mechanism communicates using pulses that can be decoded by a microcontroller
- useful for any circuit that requires user interface
- see Specification Sheet for more info
All JIGMODs include 4 standoffs and 4 screws for mounting to a JIGMOD platform.
Sample Code for Arduino:
/* Nav Wheel with LiquidCrystal Library This sketch prints "Nav Wheel" to the LCD, counts the number of Nav Wheel positions seen, and indicates what direction the Nav Wheel is being moved. The circuit: * LCD Enable pin to digital pin 0 * LCD RS pin to digital pin 2 * LCD D4 pin to digital pin 4 * LCD D5 pin to digital pin 5 * LCD D6 pin to digital pin 6 * LCD D7 pin to digital pin 7 * LCD R/W pin to ground * LCD VSS pin to ground * LCD VCC pin to 5V * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) * Nav Wheel PB signal to pin 8 * Nav Wheel A signal to pin 10 * Nav Wheel B signal to pin 9 * Nav Wheel COM to ground */ #include <LiquidCrystal.h> // include the library code: LiquidCrystal lcd(2, 0, 4, 5, 6, 7); // initialize the library with the numbers of the interface pins unsigned char temp=0; unsigned char AB_state_past = B01; unsigned char AB_state_current = B00; unsigned char progbar = 0; unsigned char progbarhalf = 0; void setup() { lcd.begin(16, 2); // set up the LCD's number of columns and rows lcd.print("Nav Wheel"); // print a message to the LCD. pinMode (8, INPUT_PULLUP); // set pin 8 as an input, default high pinMode (9, INPUT_PULLUP); // set pin 9 as an input, default high pinMode (10, INPUT_PULLUP); // set pin 10 as an input, default high } void Navwheel_right () { progbar++; // increment progbar variable by 1 lcd.setCursor(11, 1); // set LCD cursor to col 8, row 1 lcd.print("RIGHT"); } void Navwheel_left () { progbar--; // subtract progbar variable by 1 lcd.setCursor(11, 1); lcd.print(" LEFT"); } void loop() { AB_state_current = PINB & B00000011; // take the lowest 2 bits of B port (pin 8 and 9 and put into variable if (AB_state_past != AB_state_current) { if ((AB_state_past == B00 && AB_state_current == B10) || (AB_state_past == B10 && AB_state_current == B11) || (AB_state_past == B11 && AB_state_current == B01) || (AB_state_past == B01 && AB_state_current == B00)) { Navwheel_right(); } if ((AB_state_past == B00 && AB_state_current == B01) || (AB_state_past == B01 && AB_state_current == B11) || (AB_state_past == B11 && AB_state_current == B10) || (AB_state_past == B10 && AB_state_current == B00)) { Navwheel_left(); } AB_state_past = AB_state_current; } lcd.setCursor(14, 0); // Set LCD cursor to col 0, row 1 if (!digitalRead(10)) { lcd.print("PB"); } if (digitalRead(10)) { lcd.print(" "); } lcd.setCursor(0, 1); // Set LCD cursor to col 0, row 1 progbarhalf = progbar / 2; // ignores halfway-clicks from Nav Wheel lcd.print(progbarhalf); lcd.print(" "); } |
We Also Recommend