Bonjour,
Je suis plus que novice en programmation en général et en arduino en particulier. J'ai réussi à me construire le shield photoduino v3. Mon problème est que lorsque je vérifie le squetch avant le téléversement, un code d'erreur s'affiche et je ne sais quoi faire. Pourriez-vous m'aider s'il vous plait?
Voici le squetch ci-dessous avec en rouge la ligne concernée.
Le message d'erreur est alors: 'prog_char' does not name a type
Merci d'avance pour votre aide précieuse.
* This file is part of Photoduino.
*
* Photoduino is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Photoduino is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Photoduino. If not, see <http://www.gnu.org/licenses/>.
*/
// Shoots the flash after wait a delay
void flash_shoot(unsigned int previousDelay, byte pin) {
delay(previousDelay);
digitalWrite(pin,HIGH);
delayMicroseconds(DEVICES_FLASHES_SHOOTING_PULSE);
digitalWrite(pin,LOW);
}
// Begins the shutter
void camera_shutterBegin(unsigned int shutterLag){
digitalWrite(PINS_SHUTTER,HIGH);
delay(shutterLag);
}
// Ends the shutter
void camera_shutterEnd(unsigned int preCloseTime){
delay(preCloseTime);
digitalWrite(PINS_SHUTTER,LOW);
}
// Begins the autofocus
void camera_autofocusBegin(unsigned int autofocusTime){
digitalWrite(PINS_AUTOFOCUS,HIGH);
delay(autofocusTime);
}
// Ends the autofocus
void camera_autofocusEnd(){
digitalWrite(PINS_AUTOFOCUS,LOW);
}
// Look-up the mirror
void camera_mirrorLockUp(unsigned int autofocusTime, unsigned int shutterLag){
digitalWrite(PINS_AUTOFOCUS,HIGH);
delay(autofocusTime);
digitalWrite(PINS_SHUTTER,HIGH);
delay(shutterLag);
digitalWrite(PINS_SHUTTER,LOW);
digitalWrite(PINS_AUTOFOCUS,LOW);
}
// Reads the value of a sensor
unsigned int sensor_read(byte sensorPin) {
unsigned int value = analogRead(sensorPin);
if (value>999) value = 999;
if (sensorPin == PINS_SENSOR_MIC) {
if (value > 500) value = (value-500)*2;
else value = (500-value)*2;
}
return value;
}
// Sets the sensor pin and sensor mode according the sensor type
void sensor_getConfiguration(byte sensorType, unsigned int **limitValue, byte *sensorPin, byte *sensorMode) {
if (sensorType == SENSOR_TYPE_NONE) { }
else if (sensorType == SENSOR_TYPE_AUDIO) { *sensorPin = PINS_SENSOR_MIC; *sensorMode = SENSOR_MODE_HIGHER; *limitValue = &sensorTriggerMode_sensorAudioLimit; }
else if (sensorType == SENSOR_TYPE_SHOCK) { *sensorPin = PINS_SENSOR_SHOCK; *sensorMode = SENSOR_MODE_HIGHER; *limitValue = &sensorTriggerMode_sensorShockLimit; }
else if (sensorType == SENSOR_TYPE_LIGHT) { *sensorPin = PINS_SENSOR_BARRIER; *sensorMode = SENSOR_MODE_HIGHER; *limitValue = &sensorTriggerMode_sensorLightLimit;}
else if (sensorType == SENSOR_TYPE_BARRIER) { *sensorPin = PINS_SENSOR_BARRIER; *sensorMode = SENSOR_MODE_LOWER; *limitValue = &sensorTriggerMode_sensorBarrierLimit;}
}
// Waits for sensor cross the limit
boolean sensor_waitFor(byte sensorType, unsigned int limitTime){
boolean result = false;
if(sensorType != SENSOR_TYPE_NONE){
byte sensorPin;
byte sensorMode;
unsigned int *limitValue;
sensor_getConfiguration(sensorType, &limitValue, &sensorPin, &sensorMode);
unsigned long time = millis();
unsigned int sensorValue = sensor_read(sensorPin);
for(; !result && !cancelFlag && (millis()<time+limitTime || limitTime==0); sensorValue = sensor_read(sensorPin)) {
if (sensorMode==SENSOR_MODE_HIGHER && sensorValue>=*limitValue) result = true;
if (sensorMode==SENSOR_MODE_LOWER && sensorValue<=*limitValue) result = true;
}
if(cancelFlag) result = true;
} else {
result = true;
}
return result;
}
// Called in interrupt mode when any button is pressed
void keyboard_interrupts(){
if (!digitalRead(PINS_BTN_A)&&!digitalRead(PINS_BTN_B)) cancelFlag = false;
else cancelFlag = true;
}
// Scans keyboard in normal mode
void keyboard_scan() {
keyboard_scan(false);
}
// Scans keyboard buttons
void keyboard_scan(boolean quickmode) {
unsigned long time = millis();
if (flagHoldKey && !quickmode) {
buzzer_beep(100);
while(digitalRead(PINS_BTN_A) || digitalRead(PINS_BTN_B)) {}
flagHoldKey = false;
lastKey = KEY_NONE;
} else if (digitalRead(PINS_BTN_A)) {
while(digitalRead(PINS_BTN_A) && (millis()-time) <= KEY_HOLD_TIME+KEY_HOLD_TIME_WAIT){
if (millis()-time >= KEY_DEBOUNCE_TIME) lastKey = KEY_A;
if (millis()-time >= KEY_HOLD_TIME) { if(digitalRead(PINS_BTN_B)) lastKey = KEY_ABH; else lastKey = KEY_AH; flagHoldKey = true; }
}
} else if (digitalRead(PINS_BTN_B)) {
while(digitalRead(PINS_BTN_B) && (millis()-time) <= KEY_HOLD_TIME+KEY_HOLD_TIME_WAIT){
if (millis()-time >= KEY_DEBOUNCE_TIME) lastKey = KEY_B;
if (millis()-time >= KEY_HOLD_TIME) { if(digitalRead(PINS_BTN_A)) lastKey = KEY_ABH; else lastKey = KEY_BH; flagHoldKey = true; }
}
} else {
flagHoldKey = false;
lastKey = KEY_NONE;
}
}
// Waits until any key is pressed
void keyboard_waitForAnyKey(){
do{ keyboard_scan(); } while (lastKey==KEY_NONE);
}
// Waits until no key is pressed
void keyboard_waitForNokey(){
do{ keyboard_scan(); } while (lastKey!=KEY_NONE);
}
// Beeps buzzer a time in ms
void buzzer_beep(int time){
if (system_useSpeaker){
analogWrite(PINS_BUZZER,64);
delay(time);
analogWrite(PINS_BUZZER,0);
} else {
delay(time);
}
}
// Init the backlight
void backlight_init(){
digitalWrite(PINS_LCD_LED, system_useBacklight);
}
// Toggle the backlight status (on/off)
void backlight_toggle(){
system_useBacklight = !system_useBacklight;
digitalWrite(PINS_LCD_LED, system_useBacklight);
}
// Print on lcd a progmem string
void display_printMessage(const prog_char* str) {
char c;
if (!str) return;
while ((c = pgm_read_byte(str))) {
lcd.print(c);
str++;
}
}
// prints screen title
void display_printTitle(const prog_char* str){
lcd.clear();
lcd.print(">");
display_printMessage(str);
lcd.setCursor(0,1);
}
// prints screen title
void display_printQuestion(const prog_char* str){
lcd.clear();
lcd.print(">");
display_printMessage(str);
lcd.print("?");
lcd.setCursor(0,1);
}
[color=red]void display_printEnumeration(byte num, const prog_char* str){[/color]
lcd.print(num, 10);
lcd.print(".");
display_printMessage(str);
}
// prints aborting message
void display_printResetting(){
lcd.clear();
display_printMessage(MSG_RESETTING);
}
// prints aborting message
void display_printAborting(){
lcd.clear();
display_printMessage(MSG_ABORTING);
}
...ETC...ETC