GPIO program for K64F boards
Dependencies: mbed DigitDisplay LED_Bar
Diff: main.cpp
- Revision:
- 2:a1e7d7fa0db2
- Parent:
- 0:880457ab5a77
--- a/main.cpp Thu Apr 18 19:24:12 2019 +0000
+++ b/main.cpp Wed Feb 05 19:46:54 2020 +0000
@@ -1,19 +1,19 @@
#include "mbed.h"
-
-DigitalIn enable(PTE24);
-Serial pc(USBTX, USBRX);
-
-int main() {
- pc.baud(115200);
- while(1) {
- pc.printf("its inside while loop now\n");
- if(!enable) {
- pc.printf("led is on\n");
- }
- else
- {
- pc.printf("false\n");
- }
- wait(0.25);
- }
+//PWM output channel
+PwmOut PWM1(A5);
+int main()
+{
+PWM1.period_ms(500);
+int x;
+x=1;
+while(1)
+{
+PWM1.pulsewidth_ms(x);
+x=x+1;
+wait(2);
+if(x==500)
+{
+x=1;
+}
+}
}
\ No newline at end of file