Feature #218
Que el led de power del joystick parpadee cuando se detecte algún contacto
Description
Hacer que ese led se apague cuando detecte algo, y que se encienda si no.
History
#1 Updated by Txinto Vaz about 8 years ago
Añadimos alguna inicialización a prj_pinout.cpp y prj_pinout.h
...
/**** Pin assigment section ****/
#define CFG_POWERGND_PIN 2
...
...
/* Prepares the pinout for project use */
void pinoutInit(void){
/* Configure the power led DO pin */
pinMode(CFG_POWERGND_PIN,OUTPUT);
...
Añadimos unas cuantas líneas a prj_output.cpp
...
void prjOutputInit(void) {
digitalWrite(CFG_POWERGND_PIN,LOW);
...
}
void prjOutput(void) {
/* When any button is pressed, the power pin will be switched down to indicate something is detected */
/* By default, the power led must be active */
digitalWrite(CFG_POWERGND_PIN,LOW);
/************* BUTTONS SECTION ***************/
// read digital pins and use them for the buttons
for (uint8_t i=0; i<CFG_JOYSTICK_NUMBER_OF_BUTTONS ; i++) {
if (dre.detection.allButtons[i] == 1) {
/* When any button is pressed, the power pin will be switched down to indicate something is detected */
digitalWrite(CFG_POWERGND_PIN,HIGH);
}
...
}
/************ JOYSTICK SECTION ***************/
...
for (uint8_t i=0; i<CFG_JOYSTICK_NUMBER_OF_POSITIONS ; i++) {
if (dre.detection.detectedJoy[i]) {
/* When any button is pressed, the power pin will be switched down to indicate something is detected */
digitalWrite(CFG_POWERGND_PIN,HIGH);
}
}
...
}
#2 Updated by Txinto Vaz about 8 years ago
- File photo668429746462369752.jpg View added
- File photo668429746462369751.jpg View added
- Status changed from New to In Progress
Apagado:
Encendido:
#3 Updated by Txinto Vaz about 8 years ago
- % Done changed from 0 to 100
#4 Updated by Txinto Vaz about 8 years ago
- Status changed from In Progress to Resolved
#5 Updated by Txinto Vaz about 8 years ago
- Status changed from Resolved to Closed