29-07-2015, 02:26
tyntop, in fact and according to the info I read on some of the sketch examples, to read the encoder with readability, you must use at least one pin with interrupts capability. Arduino Nano have two, and both are already used by the WeatherDuino Pro2 TX software, one for the wind speed and the other for the rain gauge.
The rotary encoder library, includes an sketch example, that can be used to read the encoder when it is connected to pins without interrupt capabilities. You, correctly tried to use that code, but as is stated on the comments, using this method you can only track very slow motion, and it also requires that you loop through the read procedure very quickly, which not happen when the code was inserted in the TX code. I think this is why, you can read it with your May24 sketch code.
Maybe there are some solutions, but keep in mind that dealing with interrupts requires advanced knowledge of the specific microcontroller, and most of those technics are far ahead of my own knowledge.
Don't give up in your intention. Take a breadboard, put a Nano on it, and continue with your experiments, you don't lose nothing, by the contrary you win knowledge.
Try your sketch (May24) changing the encoder pins between pins with interrupt capability and other without that capability, certainly you will find a great difference.
Arduino nano pins 2 (interrupt 0) and 3 (interrupt 1) have interrupt capability.
The rotary encoder library, includes an sketch example, that can be used to read the encoder when it is connected to pins without interrupt capabilities. You, correctly tried to use that code, but as is stated on the comments, using this method you can only track very slow motion, and it also requires that you loop through the read procedure very quickly, which not happen when the code was inserted in the TX code. I think this is why, you can read it with your May24 sketch code.
Quote:// Best Performance: both pins have interrupt capability
// Good Performance: only the first pin has interrupt capability
// Low Performance: neither pin has interrupt capability
Maybe there are some solutions, but keep in mind that dealing with interrupts requires advanced knowledge of the specific microcontroller, and most of those technics are far ahead of my own knowledge.
Don't give up in your intention. Take a breadboard, put a Nano on it, and continue with your experiments, you don't lose nothing, by the contrary you win knowledge.
Try your sketch (May24) changing the encoder pins between pins with interrupt capability and other without that capability, certainly you will find a great difference.
Arduino nano pins 2 (interrupt 0) and 3 (interrupt 1) have interrupt capability.

