Stumped by error messages - pulling from separate library
i building own variation of project found here:
http://www.instructables.com/id/arduino-binary-alarm-clock/
it includes library tones:
http://arduino-tone.googlecode.com/files/tone-v0004.zip
i got rid of switch selecting time , alarm setting , replaced them separate buttons.
i removed capacitive switch snooze button , replaced physical button.
due original author writing in tabs, code in several posts
here modified code:
and here error codes:
other changing pin assignments, didn't make changes code , can't figure out these error codes referring to.
http://www.instructables.com/id/arduino-binary-alarm-clock/
it includes library tones:
http://arduino-tone.googlecode.com/files/tone-v0004.zip
i got rid of switch selecting time , alarm setting , replaced them separate buttons.
i removed capacitive switch snooze button , replaced physical button.
due original author writing in tabs, code in several posts
here modified code:
code: [select]
/*
==========arduino binary alarm clock==========
| author: martin forsgren |
| date: 15-11-2009 |
==============================================
*/
#include <capsense.h> // library touchsensors
#include <tone.h> // library soundgeneration
#define debug 0 // set 1 debugging output via serial.
// display pins:
int hour_pins[] = {18, 17, 16, 15, 14}; // hour pins pins 14 18
int minute_pins[] = {13, 12, 11, 10, 9, 8}; // minute pins 8 13
// values in falling order because connected pins way accident
// button pins:
int hour_button_pin = 6;
int minute_button_pin = 5;
int settime_button_pin = 7;
int setalarm_button_pin = 4;
int snooze_button = 3;
// sound:
int speaker_pin = 19;
tone tone_maker;
// button states:
int hour_button_state;
int minute_button_state;
int settime_button_state;
int setalarm_button_state;
int snooze_button_state;
// clock variables, stores current time:
int seconds = 0;
int minutes = 10;
int hours = 10;
// hours_p , minutes_p pointers used decide:
// - if ordinary time or alarm time shoud displayed
// - if time or alarm time should changed when buttons pressed
int * hours_p = &hours; // points hours or alarm_hours depending
// on setting_switch_state
int * minutes_p = &minutes; // points minutes or alarm_minutes depending
// on setting_switch_state
// alarm variables:
boolean alarm_on = false;
boolean signal_on = false;
boolean snooze_on = false;
// alarm time:
int alarm_hours = 20;
int alarm_minutes = 20;
// time when snooze period should end:
int snooze_off_hours;
int snooze_off_minutes;
int debug_print_counter = 0;
void setup()
{
// set 6 minute pins output:
for(int = 0; < 7; i++)
{
pinmode(minute_pins[i], output);
}
// set 5 hour pins output:
for(int = 0; < 6; i++)
{
pinmode(hour_pins[i], output);
}
// set button pins input:
pinmode(hour_button_pin, input);
pinmode(minute_button_pin, input);
pinmode(settime_button_pin, input);
pinmode(setalarm_button_pin, input);
// activate internal pullup resistors:
digitalwrite(hour_button_pin, high);
digitalwrite(minute_button_pin, high);
digitalwrite(settime_button_pin, high);
digitalwrite(setalarm_button_pin, high);
digitalwrite(snooze_button, high);
//output sound speaker_pin:
tone_maker.begin(speaker_pin);
}
void loop()
{
clock(); // keep track of time, i.e. update hours,
// minutes , seconds variables needed.
display(); // display time, or alarm time, depending on state of settings switch.
alarm(); // checks if it's time alarm start.
update_buttons_state(); // checks if buttons , touch sensor states has changed
//update_buttons_state_with_debounce();
buttons(); // buttons should do
}
and here error codes:
code: [select]
c:\users\tech\documents\arduino\libraries\tone\tone.cpp: in member function 'void tone::begin(uint8_t)':
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:125: error: 'bitwrite' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:127: error: 'digitalpintoport' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:127: error: 'portoutputregister' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:128: error: 'digitalpintobitmask' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp: in member function 'void tone::play(int, long unsigned int)':
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:201: error: 'output' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:201: error: 'pinmode' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:284: error: 'bitwrite' not declared in scope
c:\users\tech\documents\arduino\libraries\tone\tone.cpp: in member function 'void tone::stop()':
c:\users\tech\documents\arduino\libraries\tone\tone.cpp:359: error: 'digitalwrite' not declared in scope
other changing pin assignments, didn't make changes code , can't figure out these error codes referring to.
here's clock code:
code: [select]
//"internal" variables clock function:
#define max_millis_value 34359738
unsigned long current_millis_value = 0;
unsigned long previous_millis_value = 0;
unsigned long m = 0;
/*
unsigned int seconds = 0;
unsigned int minutes = 0;
unsigned int hours = 0;
*/
void clock()
{
current_millis_value = millis();
if (current_millis_value < previous_millis_value) // if millis overflows
{
m += max_millis_value - previous_millis_value + current_millis_value;
}
else // if millis has not overflown
{
m += current_millis_value - previous_millis_value;
}
seconds += m / 1000;
m = m % 1000;
minutes += seconds / 60;
seconds = seconds % 60;
hours += minutes / 60;
minutes = minutes % 60;
hours = hours % 24;
previous_millis_value = current_millis_value;
}
/* clock function uses if statements instead of modulo */
void ifclock()
{
current_millis_value = millis();
if (current_millis_value < previous_millis_value) // if millis overflows
{
m += max_millis_value - previous_millis_value + current_millis_value;
}
else // if millis has not overflown
{
m += current_millis_value - previous_millis_value;
}
if (m>999)
{
seconds++;
m = m-1000;
}
if (seconds>59) // if seconds == 60
{
minutes++;
seconds = 0;
}
if (minutes>59) // if minutes == 60
{
hours++;
minutes = 0;
}
if (hours>23) // if hours == 24
{
hours = 0;
}
previous_millis_value = current_millis_value;
}
Arduino Forum > Using Arduino > Programming Questions > Stumped by error messages - pulling from separate library
arduino
Comments
Post a Comment