A DC motor is any of a class of electrical machines that converts direct current electrical power into mechanical power.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 BusOut port(p5,p6);
00004 DigitalIn sw(p7);
00005 int main()
00006 {
00007     while(1)
00008     {
00009         if(sw==1)
00010         {
00011             port=1;
00012             wait(0.2);
00013             }
00014     else if(sw==0)
00015             {
00016                 port=2;
00017                 wait(0.2);
00018                 }
00019                 }
00020                 }
00021