ELCT302 Motor / Mbed 2 deprecated motor

Dependencies:   mbed MotorLab3Code

Committer:
rjs718
Date:
Wed Jan 30 21:05:23 2019 +0000
Revision:
0:cb571e42343c
Child:
1:5b2bc7ec7b14
ghjk

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rjs718 0:cb571e42343c 1 #include "mbed.h"
rjs718 0:cb571e42343c 2 #include <iostream>
rjs718 0:cb571e42343c 3 Serial pc(USBTX, USBRX);
rjs718 0:cb571e42343c 4
rjs718 0:cb571e42343c 5 AnalogIn AI_in(PTB0);
rjs718 0:cb571e42343c 6 PwmOut PWM_out(PTE20);
rjs718 0:cb571e42343c 7
rjs718 0:cb571e42343c 8 float SP;
rjs718 0:cb571e42343c 9 float DC;
rjs718 0:cb571e42343c 10
rjs718 0:cb571e42343c 11 int main() {
rjs718 0:cb571e42343c 12 PWM_out.period(.05);
rjs718 0:cb571e42343c 13
rjs718 0:cb571e42343c 14 while(1) {
rjs718 0:cb571e42343c 15 SP=AI_in;
rjs718 0:cb571e42343c 16 DC=SP / 3.3;
rjs718 0:cb571e42343c 17 PWM_out=DC * 100;
rjs718 0:cb571e42343c 18 cout <<PWM_out.read() << endl;
rjs718 0:cb571e42343c 19
rjs718 0:cb571e42343c 20
rjs718 0:cb571e42343c 21 }
rjs718 0:cb571e42343c 22 }