Hello!
If I run this code:
everything works as a charm. I press a button and the the correstpoding led lights on.
But if I simply introduce an analogWriteFrequency() function on the setup, then only the first button is read.
Is there a compatibility issue? Anything is missing?
I've used the serial monitor to check that the problem is in button reading, not in the leds control.
I've also tried to use different PWM pins, corresponding to the different FMTx of he Teensy v3.2. Same with several different frequencies.
Best regards. Thank you in advance.
If I run this code:
Code:
#include <TM1638.h>
// define a module on data pin 8, clock pin 9 and strobe pin 7
TM1638 module(8, 9, 10);
void setup() {
// display a hexadecimal number and set the left 4 dots
module.setDisplayToHexNumber(0x1234ABCD, 0xF0);
}
void loop() {
byte keys = module.getButtons();
// light the first 4 red LEDs and the last 4 green LEDs as the buttons are pressed
module.setLEDs(((keys & 0xF0) << 8) | (keys & 0xF));
}
everything works as a charm. I press a button and the the correstpoding led lights on.
But if I simply introduce an analogWriteFrequency() function on the setup, then only the first button is read.
Code:
#include <TM1638.h>
// define a module on data pin 8, clock pin 9 and strobe pin 7
TM1638 module(8, 9, 10);
void setup() {
// display a hexadecimal number and set the left 4 dots
module.setDisplayToHexNumber(0x1234ABCD, 0xF0);
analogWriteFrequency(6, 375000);
}
void loop() {
byte keys = module.getButtons();
// light the first 4 red LEDs and the last 4 green LEDs as the buttons are pressed
module.setLEDs(((keys & 0xF0) << 8) | (keys & 0xF));
}
Is there a compatibility issue? Anything is missing?
I've used the serial monitor to check that the problem is in button reading, not in the leds control.
I've also tried to use different PWM pins, corresponding to the different FMTx of he Teensy v3.2. Same with several different frequencies.
Best regards. Thank you in advance.