Timeline for Generating and reading a PWM signal at the same time on Arduino Uno R3?
Current License: CC BY-SA 4.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 2, 2019 at 10:39 | comment | added | uhren | You can use approach from this video: youtube.com/watch?v=p-kCPR42EtU | |
| Dec 25, 2018 at 10:13 | vote | accept | Gamdschiee | ||
| Dec 24, 2018 at 13:49 | history | edited | Gamdschiee | CC BY-SA 4.0 |
added 91 characters in body
|
| Dec 23, 2018 at 23:11 | answer | added | chrisl | timeline score: 1 | |
| Dec 23, 2018 at 20:49 | comment | added | Gamdschiee | And connecting pwm pin to another pin, which is used as interrupted pin doesn't make any difference. | |
| Dec 23, 2018 at 20:27 | comment | added | Gamdschiee | But that makes no sense, the right pwm_value should be 1000000 us right? | |
| Dec 23, 2018 at 20:26 | comment | added | Gamdschiee | @Juraj Yes right. I tried to do it without Serial.println(); in loop() and I also added attachInterrupt to setup(). I set both delays to 1000 (which should be in ms). But the pwm_value is only 16984, which are micro seconds. ---> 16,9ms | |
| Dec 23, 2018 at 19:11 | answer | added | leoc7 | timeline score: 0 | |
| Dec 23, 2018 at 19:04 | comment | added | chrisl | With your current code the delays are so long, that you can see the code working by connecting a LED to the output pin. An on time of 400ms is well noticable by eye. Though I wouldn't call this slow signal PWM. | |
| Dec 23, 2018 at 18:20 | history | edited | Jot | CC BY-SA 4.0 |
added 1 character in body
|
| Dec 23, 2018 at 18:19 | comment | added | Jot | If a digitalWrite is not working for an output pin, then you should not use that arduino board anymore. You create a extra code that can have bugs to test something very simple, it is therefor more likely that the extra code is wrong. It is allowed to do a digitalRead for an output pin, you can therefor make the pin high, and read if it is really high. But please don't do that. If that fails, then something else is very wrong. When you assign a value to a variable (for example int i = 3 ;), how do you know that does work? Do you want to add extra tests to check if the variables do work? | |
| Dec 23, 2018 at 17:15 | comment | added | Juraj♦ | wire the pin to other pin and read the other pin. what you generate is not PWM. you don't attach any interrupt in setup. use CHANGE interrupt | |
| Dec 23, 2018 at 17:05 | review | First posts | |||
| Dec 23, 2018 at 17:38 | |||||
| Dec 23, 2018 at 17:00 | history | asked | Gamdschiee | CC BY-SA 4.0 |