INFO: Dieses Forum nutzt Cookies...
Cookies sind für den Betrieb des Forums unverzichtbar. Mit der Nutzung des Forums erklärst Du dich damit einverstanden, dass wir Cookies verwenden.

Es wird in jedem Fall ein Cookie gesetzt um diesen Hinweis nicht mehr zu erhalten. Desweiteren setzen wir Google Adsense und Google Analytics ein.

Antwort schreiben 
 
Themabewertung:
  • 0 Bewertungen - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Compilerfehler mit PROGMEM?!?!
15.10.2015, 20:39 (Dieser Beitrag wurde zuletzt bearbeitet: 15.10.2015 21:17 von Wampo.)
Beitrag #1
Compilerfehler mit PROGMEM?!?!
Hy Leute,

da ich ja immernoch auf der suche nach ner gut Strukturiertem Menü bin und ich es nicht selber auf die Kette bekomm, lad ich mir einige und Bau sie mir um, in so fern sie dafür geeignet sind.

Den nachfolgenden Code möchte ich gerne mal ausprobieren und antesten.

Code:
#include <ooPinChangeInt.h>

#include <avr/pgmspace.h>  // library for keeping variables in Flash RAM
#include <LiquidCrystal_I2C.h>     // i2c liquid crystal library

#include <AdaEncoder.h>    // adafruit.com eoncoder routine.
#include <Wire.h>

#define menuTimeout 10000  //delay before settings menus time out & return

#define sumpLevelSwitchPin 2
#define EncoderPin1 6        // Rotary Encoder Pins
#define EncoderPin2 7        //
#define buttonPin A2         // pin for encoder button

#define ATOlevel 20

#define FanPin 0
#define Heater1Pin 1
#define Heater2Pin 2
#define Light1Pin 3
#define Light2Pin 4
#define Light3Pin 5
#define ATOPin 6
#define SkimmerPin 7
#define Powerhead1Pin 8
#define Powerhead2Pin 9
#define Powerhead3Pin 10
#define ReturnPumpPin 11
#define CircPumpPin 12
#define Doser1Pin 13
#define Doser2Pin 14
#define AuxPin 15

unsigned long lastTime;
unsigned long lastMills=0;
unsigned long timeout;

byte time[] = {
  12, 00, 00, 00}; // hr, min, sec, msec
byte Date[] = {
  01, 01, 13};     // month, day, year
byte Light1On[] = {
  9, 00};      // hr, min
byte Light1Off[] = {
  22, 00};    // hr, min
byte Light2On[] = {
  10, 00};
byte Light2Off[] = {
  21, 00};
byte Light3On[] = {
  21,00};
byte Light3Off[] = {
  9,00};
byte ATO[] = {
  1, 30};           // full, empty depth of ATO in cm
byte Doser1On[] = {
  0,0};
byte Doser1Off[] = {
  0,0};
byte Doser2On[] = {
  0,0};
byte Doser2Off[] = {
  0,0};

byte Outlets[16] = {
  1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1};
char buffer[18];
prog_char mainMenu1[] PROGMEM = "1.Water Change ";
prog_char mainMenu2[] PROGMEM = "2.Feed         ";
prog_char mainMenu3[] PROGMEM = "3.Man Override ";
prog_char mainMenu4[] PROGMEM = "4.Settings     ";
prog_char mainMenu5[] PROGMEM = "5.Exit         ";
PROGMEM const char *mainMenu[] = { mainMenu1, mainMenu2, mainMenu3, mainMenu4, mainMenu5};

prog_char OverrideMenu0[] PROGMEM = "1. Fan         ";
prog_char OverrideMenu1[] PROGMEM = "2. Heater 1    ";
prog_char OverrideMenu2[] PROGMEM = "3. Heater 2    ";
prog_char OverrideMenu3[] PROGMEM = "4. Light1      ";
prog_char OverrideMenu4[] PROGMEM = "5. Light2      ";
prog_char OverrideMenu5[] PROGMEM = "6. Light3      ";
prog_char OverrideMenu6[] PROGMEM = "7. ATO         ";
prog_char OverrideMenu7[] PROGMEM = "8. Skimmer     ";
prog_char OverrideMenu8[] PROGMEM = "9. Powerhead 1 ";
prog_char OverrideMenu9[] PROGMEM = "10.Powerhead 2 ";
prog_char OverrideMenu10[] PROGMEM = "11.Powerhead 3 ";
prog_char OverrideMenu11[] PROGMEM = "12.Return Pump ";
prog_char OverrideMenu12[] PROGMEM = "13.Circ Pump   ";
prog_char OverrideMenu13[] PROGMEM = "14.Dosing Pump1";
prog_char OverrideMenu14[] PROGMEM = "15.Dosing Pump2";
prog_char OverrideMenu15[] PROGMEM = "16.Aux Outlet  ";
prog_char OverrideMenu16[] PROGMEM = "17.Exit        ";
PROGMEM const char *OverrideMenu[] = {
  OverrideMenu0, OverrideMenu1, OverrideMenu2, OverrideMenu3, OverrideMenu4, OverrideMenu5,
  OverrideMenu6, OverrideMenu7, OverrideMenu8, OverrideMenu9, OverrideMenu10, OverrideMenu11,
  OverrideMenu12, OverrideMenu13, OverrideMenu14, OverrideMenu15, OverrideMenu16};

prog_char OverrideSelect0[] PROGMEM = "1. Auto        ";
prog_char OverrideSelect1[] PROGMEM = "2. Off         ";
prog_char OverrideSelect2[] PROGMEM = "3. On          ";
PROGMEM const char* OverrideSelect[]={
  OverrideSelect0, OverrideSelect1, OverrideSelect2};

prog_char settingsMenu0[] PROGMEM = "1. Time        ";
prog_char settingsMenu1[] PROGMEM = "2. Date        ";
prog_char settingsMenu2[] PROGMEM = "3. Light Times ";
prog_char settingsMenu3[] PROGMEM = "4. Temps       ";
prog_char settingsMenu4[] PROGMEM = "5. ATO Level   ";
prog_char settingsMenu5[] PROGMEM = "6. Dosing Pumps";
prog_char settingsMenu6[] PROGMEM = "7. Return      ";
PROGMEM const char* settingsMenu[]={
  settingsMenu0, settingsMenu1, settingsMenu2, settingsMenu3, settingsMenu4, settingsMenu5, settingsMenu6};

prog_char lightTimeMenu0[] PROGMEM = "1. Low On      ";
prog_char lightTimeMenu1[] PROGMEM = "2. High On     ";
prog_char lightTimeMenu2[] PROGMEM = "3. High Off    ";
prog_char lightTimeMenu3[] PROGMEM = "4. Low Off     ";
prog_char lightTimeMenu4[] PROGMEM = "5. Return      ";
PROGMEM const char* lightTimeMenu[]={
  lightTimeMenu0, lightTimeMenu1, lightTimeMenu2,  lightTimeMenu3, lightTimeMenu4};
prog_char tempMenu0[] = "1. Heater On   ";
prog_char tempMenu1[] = "2. Fan On      ";
prog_char tempMenu2[] = "3. Lights Off  ";
prog_char tempMenu3[] = "4. Return      ";
PROGMEM const char* tempMenu[]={
  tempMenu0, tempMenu1, tempMenu2, tempMenu3};
prog_char ATOMenu0[] = "1. Set Full    ";
prog_char ATOMenu1[] = "2. Set Empty   ";
prog_char ATOMenu2[] = "3. Add 1 cm    ";
prog_char ATOMenu3[] = "4. Return      ";
PROGMEM const char* ATOMenu[]={
  ATOMenu0, ATOMenu1, ATOMenu2, ATOMenu3};

byte heatOnTemp = 77; // Temp to turn Heat on
byte fanOnTemp = 79; // Temp to turn fan on
byte lightOffTemp = 82;

char id=0;
int total = 0;
int8_t clicks;
char *LCDline1[4]; // pointer array for pointers to LCD line 1 strings
char Line1Msg0[] = "00:00  Temp 88 F";
char Line1Msg1[] = "***Temp High ***";
char Line1Msg2[] = "*** Temp Low ***";
char Line1Msg3[] = "*** ATO  Low ***";
char Line1Msg4[] = "**No Temp Probe*";
char Line1Msg5[] = "**No Echo Probe*";
char LCDline2[] =  "Fan: Off  Htr: Off  ATO: 100%  ";

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

AdaEncoder encoderA = AdaEncoder('a', EncoderPin1, EncoderPin2);
AdaEncoder *knob=NULL;

void setup(){
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
  digitalWrite(buttonPin, LOW);
  lcd.begin(20,4);
  Serial.print("free ram: ");
  Serial.println(freeRam());
  delay(2500);

}

void loop(){
  lcd.clear();
  lcd.print("push button");
  lcd.setCursor(0,1);
  lcd.print("to start...");
  while(!digitalRead(buttonPin)){
  }
  knob = AdaEncoder::genie();  // check for input from rotary encoder
  if (knob != NULL || digitalRead(buttonPin)){
    while(digitalRead(buttonPin));
    delay(20);
    lcd.clear();
    lcd.print("going to menu");
    delay(1000);
    menu();
  }
}

int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}


// Routines for settings menus:
// - menu()
// - waterChange()
// - feed()
// - Override()
// - settings()
// - dateSet()
// - setLightTimes()
// - setTemps()
// - setATO()
// - setDosers()
// - setTime

void menu(){
  int item;
  timeout = millis() + menuTimeout;
  do{
    item = menuSelect(mainMenu, 5);
    switch (item) {
    case 0:
      waterChange();
      break;
    case 1:
      feed();
      break;
    case 2:
      overrideMenu(); // man override...
      break;
    case 3:
      settings();
      break;
    case 4:
      return;
      break;
    }
  }
  while (item != 3 && timeout > millis());
}
// ****************************************************

void waterChange(){
  i2cWrite(SkimmerPin%8, 0, SkimmerPin/8+1);  // Skimmer off
  i2cWrite(ATOPin%8, 0, ATOPin/8+1);          // ATO off
  i2cWrite(Powerhead1Pin%8, 0, Powerhead1Pin/8+1);  // Powerheads off
  i2cWrite(Powerhead2Pin%8, 0, Powerhead2Pin/8+1);
  i2cWrite(Powerhead3Pin%8, 0, Powerhead3Pin/8+1);
  i2cWrite(ReturnPumpPin%8, 0, ReturnPumpPin/8+1);  // Return pump off

  lcd.clear();
  lcd.print(F("Pwrhds, Skimmer"));
  lcd.setCursor(0,1);
  lcd.print(F("ATO, return off"));
  delay(3000);
  lcd.clear();
  lcd.print(F("Press to turn on"));
  lcd.setCursor(3,1);
  lcd.print(F("Return pump"));
  while(!digitalRead(buttonPin));  // wait for button to be pressed
  delay(30);                       // debouncing delay
  while(digitalRead(buttonPin)); // now wait for release
  delay(30);
  i2cWrite(ReturnPumpPin%8, Outlets[ReturnPumpPin]%2, ReturnPumpPin/8+1);

  lcd.setCursor(3,1);
  lcd.print(F("Powerheads "));
  while(!digitalRead(buttonPin));
  delay(30);
  while(digitalRead(buttonPin)); // now wait for release
  delay(30);
  i2cWrite(Powerhead1Pin%8, Outlets[Powerhead1Pin]%2, Powerhead1Pin/8+1);
  i2cWrite(Powerhead2Pin%8, Outlets[Powerhead2Pin]%2, Powerhead2Pin/8+1);
  i2cWrite(Powerhead3Pin%8, Outlets[Powerhead3Pin]%2, Powerhead3Pin/8+1);

  lcd.setCursor(3,1);
  lcd.print(F(" Skimmer   "));
  while(!digitalRead(buttonPin));
  delay(30);
  while(digitalRead(buttonPin)); // now wait for release
  delay(30);
  Outlets[SkimmerPin] = 0b001 + 0b10*(digitalRead(sumpLevelSwitchPin)); //Skimmer on
  i2cWrite(SkimmerPin%8, Outlets[SkimmerPin]%2, SkimmerPin/8+1);

  lcd.setCursor(3,1);
  lcd.print(F("  ATO   "));
  while(!digitalRead(buttonPin));
  delay(30);
  while(digitalRead(buttonPin)); // now wait for release
  delay(30);
  i2cWrite(ATOPin%8, Outlets[ATOPin]%2, ATOPin/8+1);

  return;
}

// ****************************************************

void feed(){
  // Return pump and skimmer off
  i2cWrite(ReturnPumpPin%8, 0, ReturnPumpPin/8+1);
  i2cWrite(SkimmerPin%8, 0, SkimmerPin/8+1);
  lcd.clear();
  lcd.print(F("Pump/skimmer off"));
  lcd.setCursor(0,1);
  lcd.print(F("press to cont..."));
  while(!digitalRead(buttonPin));
  delay(30);
  while(digitalRead(buttonPin)); // now wait for release
  delay(30); // debounce
  timeout = millis() -1; // exit out of menus on return
  return; // pup and skimmer will be returned to their normal states in the main loop
}

// ****************************************************

void overrideMenu(){
  int item;

  do{
    item = menuSelect(OverrideMenu, 17);
    if (item == 16) return;    // 17 = exit;
    int mode = menuSelect(OverrideSelect, 3);
    Outlets[item] = Outlets[item]%2 + 2*mode;
    // 'item' indexes the pointer to the proper spot; mode will be
    // 0 for auto, 1 for always off, 2 for always on; LSB (=*outlet%2)
    // is the default value, so it stays unchangedd. 2nd bit (2^1) override off,
    // 3rd bit (2^2) override on, so multiply menuSelect by 2 for bit values
    // and add.
    lcd.clear();
    lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(OverrideMenu[item]))) + 3);
    lcd.setCursor(0,1);
    lcd.print(F("Set to "));
    lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(OverrideSelect[mode]))) + 3);
    delay(2000);  
  }
  while (item != 16);
}

// ****************************************************

void settings(){
  int item;
  do{
    item = menuSelect(settingsMenu, 7);
    switch (item) {
    case 0:
      setTime("Set Time: ", time);
      break;
    case 1:
      dateSet();
      break;
    case 2:
      setLightTimes();
      break;
    case 3:
      setTemps();
      break;
    case 4:
      setATO();
      break;
    case 5:
      setDosers();
      break;
    case 6:
      return;
      break;
    }
  }
  while (item != 6);
  return;
}

// ****************************************************

void dateSet(){
  lcd.clear();
  lcd.print(F("Date:   "));
  if (Date[0] < 10) lcd.print(F("0"));
  lcd.print(Date[0]);
  lcd.print(F("/"));
  if (Date[1] < 10) lcd.print(F("0"));
  lcd.print(Date[1]);
  lcd.print(F("/"));
  lcd.print(Date[2]);
  Date[2] = lcdNumberChg(Date[2], 1, 24, 14); // get year first in case it's a leap year
  if (timeout < millis()) return;             // return if we've timed out

  Date[0] = lcdNumberChg(Date[0], 1, 12, 8);  // now get month
  if (timeout < millis()) return;             // return if we've timed out

  if (Date[0] == 4 || Date[0] == 6 || Date[0] == 9 || Date[0] == 11)
    lcdNumberChg(Date[1], 1, 30, 11); // 30 days hath september....
  else if (Date[0] == 2) {            //check for leap year
    if (Date[2]%4 == 0) lcdNumberChg(Date[1], 1, 29, 11);
    else lcdNumberChg(Date[1], 1, 28, 11);
  }
  else lcdNumberChg(Date[1], 1, 31, 11);
}

// ****************************************************

void setLightTimes(){
  int item;

  do{
    item = menuSelect(lightTimeMenu, 5);
    switch (item) {
    case 0:
      setTime("Low On:   ", Light1On );
      break;
    case 1:
      setTime("High On:  ", Light2On );
      break;
    case 2:
      setTime("High Off: ", Light2Off );
      break;
    case 3:
      setTime("Low Off:  ", Light1Off );
      break;
    case 4:
      return;
      break;
    }
  }
  while (item != 6);
}

// ****************************************************

void setTemps(){
  int item;
  do{
    item = menuSelect(tempMenu, 4);
    lcd.clear();
    switch (item){
    case 0:
      lcd.print(F("Heat on at "));
      lcd.print(heatOnTemp);
      lcd.print(F(" F"));
      heatOnTemp = lcdNumberChg(heatOnTemp, 65, 80, 11);
      break;
    case 1:
      lcd.print(F("Fan on at "));
      lcd.print(fanOnTemp);
      lcd.print(F(" F"));
      fanOnTemp = lcdNumberChg(fanOnTemp, 75, 82, 10);
      break;
    case 2:
      lcd.print(F("Lights off: "));
      lcd.print(lightOffTemp);
      lcd.print(F(" F"));
      lightOffTemp = lcdNumberChg(lightOffTemp, 75, 85, 12);
      break;
    case 3:
      return;
      break;
    }
  }
  while (item != 3);
}

// ****************************************************

void setATO(){
  boolean noATOflag = false;

  int item = menuSelect(ATOMenu, 4);
  lcd.clear();

  int ATOavg = 0;
  for (int i = 5; i > 0; i--){
    int newATO = 25; // getATO();
    ATOavg += newATO;
    if (newATO < 1) {
      ATOavg = -1;
      i = 0;      //break from loop
    }
  }
  if (ATOavg < 0){      // Make sure the echo probe is reading properly 1st
    lcd.print(F("No sensor found "));
    lcd.setCursor(0,1);
    lcd.print(F("No changes made "));
    delay(2000);
    return;
  }
  ATOavg = ATOavg/5;  // take the average of the 5 values...

  switch (item){
  case 0:
    ATO[0] = ATOavg;
    lcd.print(F(" Full level set "));
    lcd.setCursor(0,1);
    lcd.print(F("to current level"));
    break;
  case 1:
    ATO[1] = ATOavg;
    lcd.print(F("Empty level set "));
    lcd.setCursor(0,1);
    lcd.print(F("to current level"));
    break;
  case 2:
    ATO[1] = ATOavg + 1;
    lcd.print(F("Empty level set "));
    lcd.setCursor(0,1);
    lcd.print(F("at current+1 cm "));
    break;
  }
  delay(2000);
  return;
}

// ****************************************************

void setDosers(){
  lcd.clear();
  lcd.print(F("     Not yet    "));
  lcd.setCursor(0,1);
  lcd.print(F("   implemented  "));
  delay(2000);
  return;
}

// ****************************************************

// Function to set the time on the LCD display
// Display will show  "[.label..]00:00"
//                    "          ^^   "
// label must be 10 characters so carats allign with digits
// time[] is an integer array with hrs & mins
void setTime(char* label, byte time[]){  // label must be 10 characters
  lcd.clear();
  // print label followed by time
  lcd.print(label);
  if (time[0] < 10) lcd.print(F("0"));
  lcd.print(time[0]);
  lcd.print(F(":"));
  if (time[1] < 10) lcd.print(F("0"));
  lcd.print(time[1]);
  lcd.setCursor(10,1);
  lcd.print(F("^^"));  // carats under hr positio
  time[0] = lcdNumberChg(time[0], 0, 23, 10);
  time[1] = lcdNumberChg(time[1], 0, 59, 13);
  delay(2000);
}



// set a two digit number on the LCD display between Max & min (inclusive)
// at LCD column loc
// returns the nuber selected

int lcdNumberChg (int number, int numberMin, int numberMax, int loc){
  lcd.setCursor(loc,1);
  lcd.print(F("^^"));
  timeout = millis() + menuTimeout;

  byte inByte;
  do{
    AdaEncoder *thisEncoder=NULL;
    thisEncoder=AdaEncoder::genie();
    if (thisEncoder != NULL){
      timeout = millis() + menuTimeout;
      int clicks = thisEncoder->query(); // int instead of byte to make compatible with number var
      number += clicks;
      clicks = 0;
      if (number > numberMax) number = numberMin;
      if (number < numberMin) number = numberMax;
      lcd.setCursor(loc,0);
      if (number < 10) lcd.print('0');
      lcd.print(number);
    }
    if(digitalRead(buttonPin)){                   // if button's been pushed
      while (digitalRead(buttonPin)){delay(20);}  // wait for it to be released
      delay(20);                                  // delay for button debounce
      timeout = millis() - 1;                     // set timeout to exit while loop
    }
  } while (timeout > millis());
  lcd.setCursor(loc,1);
  lcd.print(F("  "));
  timeout = millis() + menuTimeout;
  return number;
}

// menuSelect - scroll through a menu, return # of selected item
//
int menuSelect(const char* menustring[], int menuItems){
  int currentItem = 0; //item that's currently selected/highlighted
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(F(">"));
  lcd.println(strcpy_P(buffer, (char*)pgm_read_word(&(menustring[0]))));
  lcd.setCursor(0,1);
  lcd.print(F(" "));
  lcd.println(strcpy_P(buffer, (char*)pgm_read_word(&(menustring[(1)%menuItems]))));
  timeout = millis() + menuTimeout;
  do {
    AdaEncoder *knob=NULL;
    knob=AdaEncoder::genie();

    if (knob != NULL){
      clicks=knob->query();
      currentItem += clicks;
      clicks = 0;
      timeout = millis() + menuTimeout; // reset timer if there's input
      currentItem = (currentItem + menuItems)%menuItems;  // wrap around
      // '+ menuitems' makes equation work if curentitem <0
      lcd.setCursor(0,0);
      lcd.print(F(">"));
      lcd.println(strcpy_P(buffer, (char*)pgm_read_word(&(menustring[currentItem]))));
      lcd.setCursor(0,1);
      if(currentItem<menuItems-1){          // we're not at the last selection ('exit')
        lcd.print(F(" "));
        lcd.println(strcpy_P(buffer, (char*)pgm_read_word(&(menustring[(currentItem +1)%menuItems]))));
      } else {                              // print the next selection
        lcd.println(F("                ")); // otherwise print a blank line on line 2
      }
    }
    if(digitalRead(buttonPin)){                  // if button's been pushed
      while (digitalRead(buttonPin)){
        delay(20);                               // wait for it to be released
      }
      delay(30);                                  //delay for btton debounce
      timeout = millis() + menuTimeout;          // reset timeout time
      return currentItem;
    }
  }
  while (timeout > millis());   // end do

  timeout = millis() + menuTimeout;
  return (menuItems-1);
}


void pause(char* msg){
  Serial.print(msg);
  Serial.println(F(", Proceed?"));
  while(!Serial.available());
  while(Serial.available()) Serial.read();
  return;
}

// ************************************
// routine to turn outlets on/off
// Pins 0-7 are in outlet bank 1, 8-15 in bank 2
// pin%8 converts to 0-7,
// pin/8+1 converts to i2c address 1 for 0-7, 2 for 8-15
// to allow for automatic assignment if pins are changed

void outlets(){
  i2cWrite(FanPin%8, Outlets[FanPin]%2, FanPin/8+1);
  i2cWrite(Heater1Pin%8, Outlets[Heater1Pin]%2, Heater1Pin/8+1);
  i2cWrite(Heater2Pin%8, Outlets[Heater2Pin]%2, Heater2Pin/8+1);
  i2cWrite(Light1Pin%8, Outlets[Light1Pin]%2, Light1Pin/8+1);
  i2cWrite(Light2Pin%8, Outlets[Light2Pin]%2, Light2Pin/8+1);
  i2cWrite(Light3Pin%8, Outlets[Light3Pin]%2, Light3Pin/8+1);
  i2cWrite(ATOPin%8, Outlets[ATOPin]%2, ATOPin/8+1);
  i2cWrite(SkimmerPin%8, Outlets[SkimmerPin]%2, SkimmerPin/8+1);

  i2cWrite(Powerhead1Pin%8, Outlets[Powerhead1Pin]%2, Powerhead1Pin/8+1);
  i2cWrite(Powerhead2Pin%8, Outlets[Powerhead2Pin]%2, Powerhead2Pin/8+1);
  i2cWrite(Powerhead3Pin%8, Outlets[Powerhead3Pin]%2, Powerhead3Pin/8+1);
  i2cWrite(ReturnPumpPin%8, Outlets[ReturnPumpPin]%2, ReturnPumpPin/8+1);
  i2cWrite(CircPumpPin%8, Outlets[CircPumpPin]%2, CircPumpPin/8+1);
  i2cWrite(Doser1Pin%8, Outlets[Doser1Pin]%2, Doser1Pin/8+1);
  i2cWrite(Doser2Pin%8, Outlets[Doser2Pin]%2, Doser2Pin/8+1);
  i2cWrite(AuxPin%8, Outlets[AuxPin]%2, AuxPin/8+1);
  Serial.println();

}

void i2cWrite(byte pin, byte value, byte addr){
  Serial.print("Write "); Serial.print(value);
  Serial.print(" to pin #"); Serial.print(pin);
  Serial.print(" at address ");Serial.println(addr);
}

Alle libs ind soweit auch geladen und funktionieren, dennoch bekomme ich die folgende der vielen Fehlermeldungen
Code:
Arduino: 1.6.5 (Windows 7), Platine: "Arduino/Genuino Uno"

sketch_oct15a:69: error: 'prog_char' does not name a type
sketch_oct15a:70: error: 'prog_char' does not name a type
sketch_oct15a:71: error: 'prog_char' does not name a type
sketch_oct15a:72: error: 'prog_char' does not name a type
sketch_oct15a:73: error: 'prog_char' does not name a type
sketch_oct15a:74: error: variable 'mainMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:74: error: 'mainMenu1' was not declared in this scope
sketch_oct15a:74: error: 'mainMenu2' was not declared in this scope
sketch_oct15a:74: error: 'mainMenu3' was not declared in this scope
sketch_oct15a:74: error: 'mainMenu4' was not declared in this scope
sketch_oct15a:74: error: 'mainMenu5' was not declared in this scope
sketch_oct15a:76: error: 'prog_char' does not name a type
sketch_oct15a:77: error: 'prog_char' does not name a type
sketch_oct15a:78: error: 'prog_char' does not name a type
sketch_oct15a:79: error: 'prog_char' does not name a type
sketch_oct15a:80: error: 'prog_char' does not name a type
sketch_oct15a:81: error: 'prog_char' does not name a type
sketch_oct15a:82: error: 'prog_char' does not name a type
sketch_oct15a:83: error: 'prog_char' does not name a type
sketch_oct15a:84: error: 'prog_char' does not name a type
sketch_oct15a:85: error: 'prog_char' does not name a type
sketch_oct15a:86: error: 'prog_char' does not name a type
sketch_oct15a:87: error: 'prog_char' does not name a type
sketch_oct15a:88: error: 'prog_char' does not name a type
sketch_oct15a:89: error: 'prog_char' does not name a type
sketch_oct15a:90: error: 'prog_char' does not name a type
sketch_oct15a:91: error: 'prog_char' does not name a type
sketch_oct15a:92: error: 'prog_char' does not name a type
sketch_oct15a:93: error: variable 'OverrideMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:94: error: 'OverrideMenu0' was not declared in this scope
sketch_oct15a:94: error: 'OverrideMenu1' was not declared in this scope
sketch_oct15a:94: error: 'OverrideMenu2' was not declared in this scope
sketch_oct15a:94: error: 'OverrideMenu3' was not declared in this scope
sketch_oct15a:94: error: 'OverrideMenu4' was not declared in this scope
sketch_oct15a:94: error: 'OverrideMenu5' was not declared in this scope
sketch_oct15a:95: error: 'OverrideMenu6' was not declared in this scope
sketch_oct15a:95: error: 'OverrideMenu7' was not declared in this scope
sketch_oct15a:95: error: 'OverrideMenu8' was not declared in this scope
sketch_oct15a:95: error: 'OverrideMenu9' was not declared in this scope
sketch_oct15a:95: error: 'OverrideMenu10' was not declared in this scope
sketch_oct15a:95: error: 'OverrideMenu11' was not declared in this scope
sketch_oct15a:96: error: 'OverrideMenu12' was not declared in this scope
sketch_oct15a:96: error: 'OverrideMenu13' was not declared in this scope
sketch_oct15a:96: error: 'OverrideMenu14' was not declared in this scope
sketch_oct15a:96: error: 'OverrideMenu15' was not declared in this scope
sketch_oct15a:96: error: 'OverrideMenu16' was not declared in this scope
sketch_oct15a:98: error: 'prog_char' does not name a type
sketch_oct15a:99: error: 'prog_char' does not name a type
sketch_oct15a:100: error: 'prog_char' does not name a type
sketch_oct15a:101: error: variable 'OverrideSelect' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:102: error: 'OverrideSelect0' was not declared in this scope
sketch_oct15a:102: error: 'OverrideSelect1' was not declared in this scope
sketch_oct15a:102: error: 'OverrideSelect2' was not declared in this scope
sketch_oct15a:104: error: 'prog_char' does not name a type
sketch_oct15a:105: error: 'prog_char' does not name a type
sketch_oct15a:106: error: 'prog_char' does not name a type
sketch_oct15a:107: error: 'prog_char' does not name a type
sketch_oct15a:108: error: 'prog_char' does not name a type
sketch_oct15a:109: error: 'prog_char' does not name a type
sketch_oct15a:110: error: 'prog_char' does not name a type
sketch_oct15a:111: error: variable 'settingsMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:112: error: 'settingsMenu0' was not declared in this scope
sketch_oct15a:112: error: 'settingsMenu1' was not declared in this scope
sketch_oct15a:112: error: 'settingsMenu2' was not declared in this scope
sketch_oct15a:112: error: 'settingsMenu3' was not declared in this scope
sketch_oct15a:112: error: 'settingsMenu4' was not declared in this scope
sketch_oct15a:112: error: 'settingsMenu5' was not declared in this scope
sketch_oct15a:112: error: 'settingsMenu6' was not declared in this scope
sketch_oct15a:114: error: 'prog_char' does not name a type
sketch_oct15a:115: error: 'prog_char' does not name a type
sketch_oct15a:116: error: 'prog_char' does not name a type
sketch_oct15a:117: error: 'prog_char' does not name a type
sketch_oct15a:118: error: 'prog_char' does not name a type
sketch_oct15a:119: error: variable 'lightTimeMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:120: error: 'lightTimeMenu0' was not declared in this scope
sketch_oct15a:120: error: 'lightTimeMenu1' was not declared in this scope
sketch_oct15a:120: error: 'lightTimeMenu2' was not declared in this scope
sketch_oct15a:120: error: 'lightTimeMenu3' was not declared in this scope
sketch_oct15a:120: error: 'lightTimeMenu4' was not declared in this scope
sketch_oct15a:121: error: 'prog_char' does not name a type
sketch_oct15a:122: error: 'prog_char' does not name a type
sketch_oct15a:123: error: 'prog_char' does not name a type
sketch_oct15a:124: error: 'prog_char' does not name a type
sketch_oct15a:125: error: variable 'tempMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:126: error: 'tempMenu0' was not declared in this scope
sketch_oct15a:126: error: 'tempMenu1' was not declared in this scope
sketch_oct15a:126: error: 'tempMenu2' was not declared in this scope
sketch_oct15a:126: error: 'tempMenu3' was not declared in this scope
sketch_oct15a:127: error: 'prog_char' does not name a type
sketch_oct15a:128: error: 'prog_char' does not name a type
sketch_oct15a:129: error: 'prog_char' does not name a type
sketch_oct15a:130: error: 'prog_char' does not name a type
sketch_oct15a:131: error: variable 'ATOMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
sketch_oct15a:132: error: 'ATOMenu0' was not declared in this scope
sketch_oct15a:132: error: 'ATOMenu1' was not declared in this scope
sketch_oct15a:132: error: 'ATOMenu2' was not declared in this scope
sketch_oct15a:132: error: 'ATOMenu3' was not declared in this scope
'prog_char' does not name a type

  Dieser Report hätte mehr Informationen mit
  "Ausführliche Ausgabe während der Kompilierung"
  aktiviert in Datei > Einstellungen

Ich benutze aktuell Arduino IDE 1.6.5

Könnte mir jemand den Fehler
sketch_oct15a:74: error: variable 'mainMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
der sich auf
PROGMEM const char *mainMenu[] = { mainMenu1, mainMenu2, mainMenu3, mainMenu4, mainMenu5};
bezieht mal genauer erklären.

Vielen dank

Okay habs grad selber rausgefunden...der mist funzt mit der neuen IDE gar nicht weil iwie kein avr/pgmspace vorhanden ist....

Ich kann diese IDE wechselsache eh nich leiden, jedes mal das leidige thema der kopiererei von den Libs..

Mit IDE versin 1.0.3 lässt sich alles wunderbar Compilen
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
15.10.2015, 21:52
Beitrag #2
RE: Compilerfehler mit PROGMEM?!?!
Da du ja noch auf der Suche bist, wie du schreibst, dann schau dir doch dies Menü mal an.

Oder kennst du es schon.

http://forum.arduino.cc/index.php?topic=73816.0

Ich setze es in einigen meiner Projekte ein und bin sehr zufrieden. Es ist sehr flexibel in der Verwendung.

I2C = weniger ist mehr: weniger Kabel, mehr Probleme. Cool
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
15.10.2015, 22:24
Beitrag #3
RE: Compilerfehler mit PROGMEM?!?!
hy hotsystems,

ja das kenne ich und finde es bis jetzt auch am allerbesten. Das problem ist nur das diese Menüsteuerung mit nem Rotary Encoder überhaupt nicht funktioniert, also nur sporadisch ganz gut.

Menüpunkte können nicht präzises angewählt werden. Habe auch schon mit den Encoderzeiten rumgespielt aber das bringt nix, weil er keine Interrupts benutzt. und bei seiner Struktur blick ich gar nichts mehr....:eek:

Greez Wampo
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
15.10.2015, 22:38
Beitrag #4
RE: Compilerfehler mit PROGMEM?!?!
(15.10.2015 22:24)Wampo schrieb:  hy hotsystems,

ja das kenne ich und finde es bis jetzt auch am allerbesten. Das problem ist nur das diese Menüsteuerung mit nem Rotary Encoder überhaupt nicht funktioniert, also nur sporadisch ganz gut.

Menüpunkte können nicht präzises angewählt werden. Habe auch schon mit den Encoderzeiten rumgespielt aber das bringt nix, weil er keine Interrupts benutzt. und bei seiner Struktur blick ich gar nichts mehr....:eek:

Greez Wampo

Ok, bisher nutze ich nur Tasten, habe mir aber vorgenommen, den Rotary Encoder einzusetzen. Muss mal schauen, wann ich dazu komme. Aktuell ist die Zeit zu knapp, aber hat Priorität.

Zitat: Menüpunkte können nicht präzise angewählt werden
Das kann ich mir gar nicht vorstellen, da ich das Menü ja mit meinen Tasten "var++" oder "var--" auch exakt anspringen kann. Das sind auch nur zahlen, die ich dann aus dem Encoder hole.

Dann werde ich mal berichten.

I2C = weniger ist mehr: weniger Kabel, mehr Probleme. Cool
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
15.10.2015, 23:50
Beitrag #5
RE: Compilerfehler mit PROGMEM?!?!
Probier es einfach mal aus, ich benutze einen Panasonic Encoder.
Kann mir aber auch nicht vorstellen das es an dem Rotary Encoder selber liegt, weil in dem jetztigen Menüablauf den ich habe läuft er 1. superschnell und 2. ich kann ihn präzise setzen.

Würde mich Interessieren was ich da falsch mache bzw. ob es bei dir auch so versch***** läuft. Big Grin

Naja die Taster liest du laut der Programmstruktur einzeln aus und das dazu noch "langsam", ich bin es einfach gewohnt einen Rotary eine runde rumzudrehen ohne auf eine bestimmte drehfrequenz zu achten Wink

Aber an dieser stelle jetzt schon mal danke fürs Feedback

Greez Wampo
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
Antwort schreiben 


Möglicherweise verwandte Themen...
Thema: Verfasser Antworten: Ansichten: Letzter Beitrag
  kniffeliger Compilerfehler - ich verzweifle noch.... HaWe 13 1.970 22.11.2014 11:49
Letzter Beitrag: tito-t
  PROGMEM Array verändern Georg 3 1.099 15.07.2014 07:48
Letzter Beitrag: Georg

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste