We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

0

If you drive the speaker pin from an interrupt, you will inevitably have some jitter, as the interrupt request will sometimes fire while the CPU is processing another ISR. This can lead to one of the levels being held for longer than expected, which in turn leads to spurious frequencies in the output. Note that these are not really harmonics (harmonics ...


1

Looks like my tone frequency was possibly just too high for the buzzer I was using, causing strange output. Adjusting the clock divider fixed the issue. That is, I changed the following: TCCR2B = _BV(CS20); // clk/1 to TCCR2B = _BV(CS22) | _BV(CS20); // clk/128 and now I get reasonable-sounding tones. Note that the clock divider you choose is ...


2

I tried the code on an Uno and as you say, it does sound odd. By my calculations, the frequency is 40kHz (16MHz/(200 x 2)), which is above the threshold of hearing. The sound we are actually hearing is probably the 3rd or 5th harmonic, at a reduced intensity and perhaps subject to jitter. I tried changing TCCR2B = _BV(CS20); // clk/1 to TCCR2B = _BV(...


0

+5V I understand for higher power people driving motors trigger a MOSFET transister which normally can go to 30 volts but this unit here appears to be able to switch 100 volts: https://www.banggood.com/100V-9_4A-FR120N-Isolated-MOSFET-MOS-Tube-FET-Relay-Module-For-Arduino-p-1396252.html this unit is likely to be able handle up to 50 Khz switching frequency (...


1

In short, I ended up creating a library capable to drive multiple DShot600 ESCs: DShot-Arduino It still need a lot more polish, but the bit-banging works really well. SPI method I tried the method @dannyf mentioned, which involved combining 3 SPI bytes to form 1 dShot bit and it actually works. But there's a few problem with SPI: It takes up the ...


0

This code, at least, compiles OK. I'm not sure what it's going to do on an Arduino. void setup() { pinMode (9, OUTPUT); pinMode (10, OUTPUT); TCCR1A = 0; TCCR1B = 0; TCCR1A |= (1 << WGM11) | (1 << COM1A1) | (1 << COM1B1); //non-inverting (error msg) TCCR1B |= (1 << CS10) | (1 << WGM12) | (1 << WGM13); //...


0

There is a semicolon ; missing after TCCR1B = 0 Second problem is that there is a missing } you actually left it in the comment here //prescaler 1,} separate it to two lines //prescaler 1, } Please invest some time in learning basics of C++. It's pretty fun, and surprisingly easy.


-2

Answer before updating your question: The first line is not legel, it ends with TCCR1A |= (1< Than you start a new function with void loop() Also align your code by selecting it and press ctlr-k UPDATE After changing your question/code: In this line: TCCR1B |= (1<<CS10) | (1<<WGM12) | (1<<WGM13) ; //prescaler 1,}TCCR1B |= //...


Top 50 recent answers are included