Very basic PwmOut program on the K64F

Dependencies:   mbed

Committer:
GerritPathuis
Date:
Tue Jun 21 17:26:41 2016 +0000
Revision:
1:cce9c0636038
Parent:
0:100aaea790a0
mbed library update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GerritPathuis 0:100aaea790a0 1 /*
GerritPathuis 0:100aaea790a0 2 Basic test PwmOut on the K64F //
GerritPathuis 0:100aaea790a0 3
GerritPathuis 0:100aaea790a0 4 Possible PwmOut pins are
GerritPathuis 0:100aaea790a0 5
GerritPathuis 0:100aaea790a0 6 PwmOut qq(PTA0);
GerritPathuis 0:100aaea790a0 7 PwmOut qq(PTA1);
GerritPathuis 0:100aaea790a0 8 PwmOut qq(PTA2);
GerritPathuis 0:100aaea790a0 9
GerritPathuis 0:100aaea790a0 10 PwmOut qq(PTC2);
GerritPathuis 0:100aaea790a0 11 PwmOut qq(PTC3);
GerritPathuis 0:100aaea790a0 12 PwmOut qq(PTC4);
GerritPathuis 0:100aaea790a0 13 PwmOut qq(PTC10);
GerritPathuis 0:100aaea790a0 14 PwmOut qq(PTC11);
GerritPathuis 0:100aaea790a0 15
GerritPathuis 0:100aaea790a0 16 PwmOut qq(PTD1);
GerritPathuis 0:100aaea790a0 17 PwmOut qq(PTD2);
GerritPathuis 0:100aaea790a0 18 PwmOut qq(PTD3);
GerritPathuis 0:100aaea790a0 19 */
GerritPathuis 0:100aaea790a0 20
GerritPathuis 0:100aaea790a0 21 #include "mbed.h"
GerritPathuis 0:100aaea790a0 22
GerritPathuis 0:100aaea790a0 23 PwmOut qq(PTA0); // Scoop connected to this pin and ground
GerritPathuis 0:100aaea790a0 24
GerritPathuis 0:100aaea790a0 25 int main()
GerritPathuis 0:100aaea790a0 26 {
GerritPathuis 0:100aaea790a0 27 qq.period(1/100); // Period set to 100 Hz
GerritPathuis 0:100aaea790a0 28 qq= 0.50; // Duty cycle set to 50%
GerritPathuis 0:100aaea790a0 29
GerritPathuis 0:100aaea790a0 30 while (true) {
GerritPathuis 0:100aaea790a0 31 // do something
GerritPathuis 0:100aaea790a0 32 }
GerritPathuis 0:100aaea790a0 33 }