Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 14:d059d99e9b5e
- Parent:
- 13:5601fedf0e12
- Child:
- 15:e5e34512a00e
--- a/main.cpp Wed Jul 03 08:32:41 2019 +0000 +++ b/main.cpp Wed Jul 03 08:39:20 2019 +0000 @@ -200,17 +200,22 @@ //---------------------- testing ------------- 190703 BH InterruptIn nFault(PB_15); // Motor Driver DRV bool nFaultFlag = true; + +//this interrupt function might not be necessary. need to be tested. void nFaultHigh(){ nFaultFlag = true; -// pc.puts("nFault HIGH\r\n"); -// bt.puts("nFault HIGH\r\n"); } void nFaultLow(){ nFaultFlag = false; -// pc.puts("nFault LOW\r\n"); -// bt.puts("nFault LOW\r\n"); } + +DigitalOut enable(PB_12); +DigitalOut nreset(PC_6); +PwmOut p1(PB_13); +PwmOut p2(PB_14); + + //---------------------- end ------------- 190703 BH int main() { @@ -227,8 +232,10 @@ //---------------------- testing ------------- 190703 BH nFault.mode(PullUp); nFault.fall(&nFaultLow); - nFault.rise(&nFaultHigh); - + + //this interrupt function might not be necessary. need to be tested. + nFault.rise(&nFaultHigh); + //---------------------- end ------------- 190703 BH up.mode(PullNone); @@ -250,10 +257,19 @@ while(1) { - //---------------------- testing ------------- 190703 BH - - // if (1 == flagRx) - + //---------------------- need to be tested ------------- BH + if(!nFaultFlag) + { + +// test below code (without rise interrupt callback) +// nFaultFlag = true; + + enable = 0; + nreset = 0; + p1=0; + p2=0; + wait(0.01f); + } //---------------------- end ------------- 190703 BH if (1 == flagRx)