Conceito de Classe (Private Public),

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Car.cpp Source File

Car.cpp

00001 #include "Car.h"
00002 
00003 //Porque isso só deu certo aqui.?
00004 //Quando eu colocava no car.h dava erro de multipla definição?
00005 
00006 DigitalOut turnRightLed(LED1);
00007 DigitalOut turnLeftLed(LED2); 
00008 
00009 void Car::turnRight(void){
00010     
00011     turnRightLed = 0;
00012     turnLeftLed = 1;    
00013     
00014     }
00015     
00016 void Car::turnLeft(void){
00017     
00018     turnRightLed = 1;
00019     turnLeftLed = 0;    
00020     
00021     }
00022 
00023 void Car::goStraight(void){
00024     
00025     turnRightLed = 1;
00026     turnLeftLed = 1;
00027     
00028     }
00029 
00030 uint32_t Car::getSpeed(void){
00031     
00032     return speed;
00033     
00034     }
00035 
00036 void Car::setSpeed(uint32_t value1){
00037     
00038     speed = value1;
00039     
00040     }