I took on a project to modify my coffee grinder with a cup timer which will when grinder is started switch off the grinder at a preset time=amount of weight in coffee.
Something like this: Arduino Grinder Timer - YouTube
I use a Arduino Nano with Oled display (7 pins - U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9, 8)) which works well when your code is SPI based.
The Coffee grinder timer sketch file named MazzerTimer is found here: Dropbox - File Deleted
the sketch consists of several tabs, and compiles and uploads without errors of warnings only my display will not show anything which has to do to my opinion with the I2C code used in this sketch.
Is there a way to make this code work for my setup for SPI?
I tried to find any forums which explains some basic rules how to do this but could not find any.
Can you give me some pointers? I'm not that experienced. Do In need to re-write the complete code or only the parts regarding the display? I think (hope) its the last answer ;D
Sometimes its so simple, I tried something like that earlier only I also changed other things. I was struggling with this some days now, but never tried only changing that single line... :
after using the arduino for a while as described above I figured it would be nice to have a default first screen showing information of a DHT11 combined with a bitmap of which coffee is in the grinder when the Coffee grinder isn't used (not grinding) and when you rotate the encoder it would go into the selection menu.
It is my first attempt to get this extra code in so I was sure not to get it right the first time .
I pasted a part of an other file for collecting and printing the data of a DHT11 together with a bitmap in the original file and saved it as mazzerTimer_screensaver. When compiling this new file its giving a lot of errors regarding variables not being declared in a particular scope. A few of those items are in the button tab which have not been changed by me.
I've changed the Display tab by adding the DHT11 coding and extra bitmap and I've changed the first tab "Mazzertimer_screensaver" by including DHT11.h and defining the DHT11 pins.
Could someone give me some pointers why its giving errors on the button tab which has not been changed and possibly what I've done wrong on the display tab with adding the extra coding.
You can copy/paste ALL errors here, because in your screenshot there is the top missing.
When solving errors, always solve the first one. Chances are, solving this first error will automatically solve other, wrongly reported, errors as well.
In your screenshot, the first error I see is about function encoderISR not being declared. I don't know why it says it's in file Button.h, but it's not.
Searching for "encoderISR", I see it only one time, on this line in the main file:
attachInterrupt(0, encoderISR, CHANGE);
It's generally a bad idea to copy/paste parts of programs that were not made by yourself, especially if you have no idea what you are doing...
Arduino: 1.6.7 (Mac OS X), Board:"Arduino Nano, ATmega328"
/Users/wesselboer/Documents/Arduino/MazzerTimer_screensaver/button.ino: In function 'void setup()':
button:96: error: 'encoderISR' was not declared in this scope
button:99: error: 'readSettingsEEPROM' was not declared in this scope
button:117: error: 'drawDisplay' was not declared in this scope
/Users/wesselboer/Documents/Arduino/MazzerTimer_screensaver/button.ino: In function 'void loop()':
button:126: error: 'encoderAction' was not declared in this scope
button:131: error: 'drawDisplay' was not declared in this scope
/Users/wesselboer/Documents/Arduino/MazzerTimer_screensaver/button.ino: In function 'void offSettings()':
button:46: error: 'writeSettingsEEPROM' was not declared in this scope
writeSettingsEEPROM();
^
/Users/wesselboer/Documents/Arduino/MazzerTimer_screensaver/button.ino: In function 'void offRelay()':
button:58: error: 'addEncoderIdleTime' was not declared in this scope
addEncoderIdleTime(1000);
^
In file included from /Users/wesselboer/Documents/Arduino/libraries/U8glib/U8glib.h:42:0,
from /Users/wesselboer/Documents/Arduino/MazzerTimer_screensaver/MazzerTimer_screensaver.ino:3:
/Users/wesselboer/Documents/Arduino/libraries/U8glib/utility/u8g.h:79:60: error: section attribute cannot be specified for local variables
^
/Users/wesselboer/Documents/Arduino/libraries/U8glib/utility/u8g.h:118:21: note: in expansion of macro 'U8G_SECTION' #define U8G_PROGMEM U8G_SECTION(".progmem.data")
^
/Users/wesselboer/Documents/Arduino/MazzerTimer_screensaver/display.ino:111:39: note: in expansion of macro 'U8G_PROGMEM'
const uint8_t GiraffeCoffee2_bitmap[] U8G_PROGMEM = {
^
display:136: error: expected primary-expression before 'void'
void drawDisplay() {
^
display:136: error: expected '}' before 'void'
display:136: error: expected ',' or ';' before 'void'
encoder:40: error: expected '}' at end of input
}
^
exit status 1
'encoderISR' was not declared in this scope