![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
driving software for a simple electromagnet circuit. For a uni project.
main.cpp
- Committer:
- teunman
- Date:
- 2015-09-25
- Revision:
- 0:64f1952778a3
File content as of revision 0:64f1952778a3:
#include "mbed.h" DigitalOut magnet(D4); //magnet is defined on D4 DigitalOut led(LED2); //LED is defined as LED2 DigitalIn knop(SW3); //knop is defined on SW3 int main() { led = 1; //defines LED is off while(true){ if (knop == 0){ //if button is pressed led = 0; // defines LED is on when button is pressed magnet = 1; //magnet is on } else{ led = 1; // LED is off magnet = 0; //magnet is off } } }