test

Dependencies:   Servo mbed

Fork of Servo by Frank Girald

Committer:
elriru
Date:
Fri May 11 11:26:00 2018 +0000
Revision:
3:e862bc753f48
Parent:
2:115ddb84b970
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:40d2fd0b99e6 1 #include "mbed.h"
simon 1:40d2fd0b99e6 2 #include "Servo.h"
elriru 3:e862bc753f48 3 DigitalOut led1(LED1);
elriru 3:e862bc753f48 4 InterruptIn button(D0);
elriru 3:e862bc753f48 5 Servo servomotor(D5); // PIN PWM
elriru 3:e862bc753f48 6 Serial pc(SERIAL_TX, SERIAL_RX);
simon 1:40d2fd0b99e6 7
elriru 3:e862bc753f48 8
elriru 3:e862bc753f48 9 void button_pressed()
elriru 3:e862bc753f48 10 {
elriru 3:e862bc753f48 11 led1=1;
elriru 3:e862bc753f48 12 servomotor=1;
elriru 3:e862bc753f48 13
elriru 3:e862bc753f48 14
elriru 3:e862bc753f48 15 }
elriru 3:e862bc753f48 16
elriru 3:e862bc753f48 17 void button_released()
elriru 3:e862bc753f48 18 {
elriru 3:e862bc753f48 19 led1=0;
elriru 3:e862bc753f48 20 servomotor=0;
elriru 3:e862bc753f48 21
elriru 3:e862bc753f48 22 }
elriru 3:e862bc753f48 23
simon 1:40d2fd0b99e6 24
franni 2:115ddb84b970 25 int main()
elriru 3:e862bc753f48 26
elriru 3:e862bc753f48 27 {
elriru 3:e862bc753f48 28 button.fall(&button_pressed); // Change led delay
elriru 3:e862bc753f48 29 button.rise(&button_released); // Change led
simon 1:40d2fd0b99e6 30 }