void Car::unlock(){ ///////////////// [UNLOCK] //////////////// // Set Headlight and horn to blink and honk twice when the door is unlocked digitalWrite(this->unlock_control, HIGH); delay(100); //door unlock digitalWrite(this->unlock_control, LOW); morse_code(this->blink,this->blink_dur,BLINK_LENGTH,true); // blink lights honk horn morse_code(this->blink,this->blink_dur,BLINK_LENGTH,false); // blink lights // turn signal off }
void Car::alarm(){ ///////////////// [TRIGGER-->HORN/LIGHT] //////////////// int length = 6; byte code[] = {HIGH,LOW,HIGH,LOW,HIGH,LOW}; int s_dur[] = {100,200,100,200,100,200}; int o_dur[] = {200,200,200,200,200,200}; //SOS !!!!!!! MORSE CODE !!!!!!! morse_code(code,s_dur,length,true); morse_code(code,o_dur,length,true); morse_code(code,s_dur,length,true); }
void Car::lock(){ ///////////////// [LOCK] ////////////// //Set both left and right doors to lock digitalWrite(this->lock_control,HIGH); delay(100); //LOCK!!! digitalWrite(this->lock_control,LOW); delay(100); digitalWrite(this->lock_control,HIGH); delay(100); digitalWrite(this->lock_control,LOW); // lights and horn morse_code(this->blink,this->blink_dur,BLINK_LENGTH,true); }
void invocation(const ComType com, const uint8_t *data) { switch(((MessageHeader*)data)->fid) { case FID_BEEP: { beep(com, (Beep*)data); break; } case FID_MORSE_CODE: { morse_code(com, (MorseCode*)data); break; } case FID_CALIBRATE: { calibrate(com, (Calibrate*)data); break; } default: { BA->com_return_error(data, sizeof(MessageHeader), MESSAGE_ERROR_CODE_NOT_SUPPORTED, com); break; } } }