Welcome, Guest
Username: Password: Remember me

TOPIC: rest and cahnging effect with rotary encoder

rest and cahnging effect with rotary encoder 1 year 6 months ago #1361

  • freddylamenace
  • freddylamenace's Avatar
  • OFFLINE
  • New Member
  • Posts: 13
  • Thank you received: 5
  • Karma: 2
Hi,

I can select effect with a rotary encoder and reset with switch ( Reset arduino Due when the voltage of pin RESET is ground)/

You need ;
- rotary encoder with switch without breakout board,
- two 10 Kohms resistor
- wires,

Schematic :

PIN 15-10 Kohms---GND
PIN 14--10 Kohms--GND

PIN 14- | |- GND
+ 5V----| |
PIN 15- | |-RESET

- connect ground,
- connect RESET to RESET DUE (next to 3.3 V pin)

- connect to 5 volts,
- connect pin14 and 15,
- wire 10 Kohms resistor between GND and pin 14,
- wire 10 Kohms resistors between GND and pin 15,

add this part of code :

.........
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = LOW;

void setup(){
......................
pinMode(14,INPUT);
pinMode(15,INPUT);
.........
}

void loop(){
...........
n = digitalRead(15);
if ((encoder0PinALast == LOW) && (n == HIGH)) {
if (digitalRead(14) == LOW) { effect--; if (effect <0){effect=N_EFFECT ; } }
else { effect++; if (effect>N_EFFECT){effect=0;} }
}
encoder0PinALast = n;
.........
}


If it's the wrong way, permut PIN 14 and 15 in void loop.

Easy transformation for great results

Fred
The administrator has disabled public write access.
The following user(s) said Thank You: Ray

rest and cahnging effect with rotary encoder 1 year 6 months ago #1362

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
Thanks for your contribution !!! you can maybe upload a pic of your system in the future :P all the best!
The administrator has disabled public write access.
Time to create page: 0.194 seconds
Powered by Kunena Forum
Joomla SEF URLs by Artio