Sie sind auf Seite 1von 33

/*

brauduino semi automated single vessel RIMS


created by s.mathison
Copyright (C) 2!2 Stephen Mathison

compiled on "rduino #!.

$his program is %ree so%t&are' you can redistribute it and/or modi%y
it under the terms o% the ()* (eneral +ublic ,icense as published by
the -ree So%t&are -oundation. either version / o% the ,icense. or
(at your option) any later version.

$his program is distributed in the hope that it &ill be use%ul.
but 0I$12*$ ")3 0"RR")$34 &ithout even the implied &arranty o%
M5RC1")$"6I,I$3 or -I$)5SS -2R " +"R$IC*,"R +*R+2S5. See the
()* (eneral +ublic ,icense %or more details.

3ou should have received a copy o% the ()* (eneral +ublic ,icense
along &ith this program. I% not. see 7http'//&&&.gnu.org/licenses/8.*/
//libraries
#include <EEPROM.h>
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <PID_v.h>
OneWire ds(11);
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
// push buttons
c!nst char Button_u " !3;
c!nst char Button_dn " !2;
c!nst char Button_re" " !1;
c!nst char Button_n#t " !$;
// outputs
c!nst int %eat " &;
c!nst int 'u( " );
c!nst int Bu** " 1$;
// global variables
unsi#ned int Windo+,i*e;
unsi#ned l!n# +indo+,tart-i(e;
unsi#ned l!n# start;
d!u$le ,etoint, .nut, Outut,eero(/, eero(/i, eero(/d;
//boolean auto,oop 9 %alse4
0oolean (anualLoo " 1alse;
0oolean +ater!dd " 1alse;
0oolean Con"_start " 1alse;
0oolean (u( " 1alse;
0oolean (2eat " 1alse;
0oolean +tBtn " 1alse;
0oolean auto3nter " 1alse;
0oolean te(4ea52ed " 1alse;
0oolean u(4est " 1alse;
//boolean boil,oop 9 %alse4
0oolean resu(e " 1alse;
%!at (set_te( " 35;
%!at -e(_5, sta6e-e(,u(te(3rror,-e(_'.7;
int #;
int sta6e-i(e,2o-i(e;
0yte (ain8enu " $;
0yte u(-i(e;
0yte data92:;
0yte se5ond;
//byte minute4
//byte i4
0yte Busy " $;
0yte n(0r,t6s;
0yte n(0r%os;
0yte te(%!ddr;
0yte te(L!ddr;
0yte ti(e!ddr;
0yte 0l2!ddr;
0yte 2o!dd;
char& st6;a(e9: "<

=8as2.n=,=,ta6e1=,=,ta6e2=,=,ta6e3=,=,ta6e4=,=,ta6e5=,=,ta6e6=,=,ta6e7=,=,ta6e)=,
=Boil =>;
// degree c sybmol
0yte de659): "
<
B$1$$$,
B1$1$$,
B$1$$$,
B$$$11,
B$$1$$,
B$$1$$,
B$$$11,
B$$$$$,
>;
//Speci%y the lin:s and initial tuning parameters
'.7 'yPID((.nut, (Outut, (,etoint,1$$,2$,5, 7.43C-);
//****** start o% the %untions**************
v!id )u**er(int nu(0er)
<
+!r (int i"$; i < nu(0er; i,,)
<
di6italWrite (Bu**,%.?%);
delay (5$$);
di6italWrite(Bu**,LOW);
delay(1$$);
>
>
v!id -ause_sta#e(v!id)<
0oolean sta6e_ause " 1alse;
i+ (Button_1se5_ress(Button_re"))<
Bu**er(1);
sta6e_ause " true;
di6italWrite(%eat,LOW);
di6italWrite('u(,LOW);
dislay_l5d($,$,= 'aused = );
.hile (sta6e_ause)
<
i+ (Button_1se5_ress(Button_re"))sta6e_ause"1alse;
>
>
>
v!id dis-lay_lcd (int os , int line ,c!nst char& la0le)<
l5d@setCursor(os,line);
l5d@rint(la0le);
>
// ! second button press
int )utt!n_sec_-ress (int Button_ress)<
i+ (di6ital4ead(Button_ress)""$)<
delay (1$$$);
i+ (di6ital4ead(Button_ress)""$)<
l5d@5lear();
.hile(di6ital4ead(Button_ress)""$)<
>
return 1;
>
>
return $;
>
// repeat button press
int )utt!n_re-eat (int Button_ress)<
i+ (di6ital4ead(Button_ress)""$)<
delay(2$$);
return 1;
>
return $;
>
// holds &hilst button pressed
int )utt!n_h!ld_-ress (int Button_ress)<
i+ (di6ital4ead (Button_ress)""$)<
delay(5$);
.hile (di6ital4ead (Button_ress)""$)<
>
return 1;
>
return $;
>
// reads the ;S!<62 temerature probe
v!id /e'-erature(v!id)<
ds@reset();
ds@sAi();
// start conversion and return
i+ (0(Con"_start))<
ds@+rite($#44,$);
Con"_start " true;
return;
>
// chec: %or conversion i% it isn=t complete return i% it is then convert to decimal
i+ (Con"_start)<
Busy " ds@read_0it();
i+ (Busy "" $)<
return;
>
ds@reset();
ds@sAi();
ds@+rite($#B3);
+!r ( int i " $; i < 2; i,,) < // &e need 2 bytes
data9i: " ds@read();
>
unsi#ned int ra+ " (data91: << )) , data9$:;
-e(_'.7 " (ra+($#BBBB)&$@$625;
-e(_5 " (ra+ ( $#BBBC) & $@$625;
Con"_start " 1alse;
return;
>
>
v!id PID_1E2/ (v!id)<
i+(auto3nter)<
,etoint " sta6e-e(;
>
else<
,etoint " (set_te(;
>
.nut " -e(_'.7;
i+((,etoint 3 .nut)>5)<
di6italWrite(%eat,%.?%);
i+ ((,etoint 3 .nut)<6)
<
(y'.7@Co(ute();
>
>
else<
(y'.7@Co(ute();
unsi#ned l!n# no+ " (illis();
i+(no+ 3 +indo+,tart-i(e>Windo+,i*e)
< //time to shi%t the Relay 0indo&
+indo+,tart-i(e ," Windo+,i*e;
>
i+((Outut&(Windo+,i*e41$$)) > no+ 3 +indo+,tart-i(e) di6italWrite(%eat,%.?%);
else di6italWrite(%eat,LOW);
>
>
v!id l!ad_-id_settin#s (v!id)
<
eero(/ " +ord(33'4O8@read($),33'4O8@read(1));// read the +I; settings %rom
the 55+R2M
eero(/i " +ord(33'4O8@read(2),33'4O8@read(3));
eero(/d " +ord(33'4O8@read(4),33'4O8@read(5));
eero(/i " eero(/i41$$;
(y'.7@,et-unin6s(eero(/,eero(/i,eero(/d); // send the +I; settings to the
+I;
Windo+,i*e " +ord(33'4O8@read(33),33'4O8@read(34));
(y'.7@,etOututLi(its($, 1$$);
(y'.7@,et,a(le-i(e(5$$$);
>
0oolean .ait_+!r_c!n5r' (0oolean( test)
<
+tBtn " true;
.hile (+tBtn)< // &ait %or com>rmation
i+ (Button_2old_ress(Button_re"))<
test " true;
+tBtn " 1alse;
l5d@5lear();
>
i+ (Button_2old_ress(Button_n#t))<
test " 1alse;
+tBtn " 1alse;
l5d@5lear();
>
>
>
%!at chan#e_te'-(%!at( te(_52an6e,int uer_li(it,int lo+er_li(it)
<
// Increase set temp
i+ (Button_reeat(Button_u))<
i+ (te(_52an6e>"1$$)<
te(_52an6e,,;
>
else<
te(_52an6e,"$@25;
>
i+ (te(_52an6e > uer_li(it)te(_52an6e " uer_li(it;
>
// decrease temp
i+ (Button_reeat(Button_dn))
<
i+(te(_52an6e>"1$$)<
te(_52an6e33;
>
else<
te(_52an6e3"$@25;
>
i+ ( te(_52an6e < lo+er_li(it) te(_52an6e " lo+er_li(it;
>
>
v!id quit_'!de (0oolean( ro5essLoo)
<
i+ ((di6ital4ead(Button_dn)""$) (( (di6ital4ead(Button_u)""$))<
di6italWrite(%eat,LOW);
di6italWrite('u(,LOW);
ro5essLoo " 1alse;
l5d@5lear();
>
>
v!id heat_c!ntr!l(v!id)
<
//turns heat on or o?
i+ (Button_2old_ress(Button_re"))<
i+ ((2eat""1alse)<
(2eat " true;
+indo+,tart-i(e " (illis();
>
else<
(2eat " 1alse;
di6italWrite(%eat,LOW);
>
>
>
v!id -u'-_c!ntr!l(v!id)
<
//turns the pump on or o?
i+ (Button_2old_ress(Button_n#t))<
i+ ((u( "" 1alse)<
(u( " true;
di6italWrite('u(,%.?%);
>
else<
(u( " 1alse;
di6italWrite('u(,LOW);
>
>
>
v!id -r!'-t_+!r_.ater (v!id)<
dislay_l5d($,$,= Water addedC =);
Bu**er(3);
dislay_l5d($,1,= OA Duit=);
>
v!id -u'-_-ri'e(v!id)
<
l5d@5lear();
l5d@rint(= 'u( 'ri(e =); // priming the pump
di6italWrite('u(,%.?%);
delay (1$$$);
di6italWrite('u(,LOW);
delay(2$$);
di6italWrite('u(,%.?%);
delay (1$$$);
di6italWrite('u(,LOW);
delay(2$$);
di6italWrite('u(,%.?%);
delay (1$$$);
di6italWrite('u(,LOW);
l5d@5lear();
>
v!id -u'-_rest (int sta6e)
<
i+ (sta6e""&)<
u(4est " 1alse;
i+ (-e(_5<&4@$) di6italWrite('u(,%.?%);
else di6italWrite('u(,LOW);
i+ (-e(_5 >" &5)te(4ea52ed " true;
>
else<
u(te(3rror " sta6e-e(3-e(_5;
i+ (u(te(3rror <" $)te(4ea52ed " true;
i+ ((u(-i(e < 1$))< // starts pumps and heat
di6italWrite('u(,%.?%);
u(4est "1alse;
>
i+ ((u(-i(e >" 1$))< // pump rest
di6italWrite('u(,LOW);
di6italWrite(%eat,LOW);
u(4est " true;
i+(u(-i(e>"12 66 (u(te(3rror > 1@$))u(-i(e " $;
>
>
>
v!id chec7_+!r_resu'e(v!id)<
i+(33'4O8@read(35))< // read the auto started byte to see i% it has been set and i% so
as: to resume
dislay_l5d ($,$,= 4esu(e 'ro5essC=);
dislay_l5d ($,1,= Ees ;o=);
+ait_1or_5onFr((resu(e);
i+(resu(e""true)<
te(%!ddr " (33'4O8@read(36)&3),6;
te(L!ddr " te(%!ddr,1;
ti(e!ddr " te(%!ddr,2;
# " 33'4O8@read(36);
auto3nter " true;
l5d@5lear();
>
>
>
v!id l!ad_sta#e_settin#s (v!id)<
te(%!ddr " 6; // setup intitial stage addresses
te(L!ddr " 7;
ti(e!ddr " );
n(0r,t6s " 33'4O8@read(3));// read the number o% steps
n(0r%os " 33'4O8@read(3&);//read the number o% hop additions
>
v!id start_ti'e (v!id)
<
start " (illis();
// &indo&Start$ime 9 millis()4
se5ond " $;
// minute 9 4
>
v!id sta#e_ti'in# (int sta6e)
<
i+ (((illis()3start)>1$$$)< // timing routine
start " (illis();
se5ond,,;
i+(0(te(4ea52ed))se5ond"$;// starts counting do&n &hen temp reached
i+ (se5ond>5&)<
dislay_l5d(1$,$,= =);
se5ond " $;
u(-i(e,,;
i+(sta6e "" $)u(-i(e " $;
sta6e-i(e33;
33'4O8@+rite(37,lo+Byte(sta6e-i(e));// saves stage time incase o% interuption
>
>
>
v!id h!-_add (v!id)
<
i+(2o!dd <" n(0r%os)<
i+ (sta6e-i(e "" 2o-i(e)<
Bu**er(3);
l5d@5lear();
l5d@rint(= !dd %os=);
delay(2$$$);
Bu**er(3);
2o!dd,,;
33'4O8@+rite(4&,2o!dd);
0l2!ddr,,;
2o-i(e " 33'4O8@read(0l2!ddr);
l5d@5lear();
>
>
>
v!id sta#e_l!!- (int sta6e, %!at %_te(")$, %!at L_te("3$)<
int last(inute;
.hile ((sta6e-i(e>$)(((auto3nter))<
last(inute"sta6e-i(e;
sta6e_ti(in6(sta6e);
-e(erature();// get temp
ause_sta6e();
i+ (u(4est)<
dislay_l5d($,$,= 'u( 4est =);
dislay_l5d($,1,= =);
>
else<
dislay_l5d($,$,st6;a(e9sta6e:);
dislay_l5d(6,$,= =);
dislay_l5d(11,$,=-G=);
l5d@rint(sta6e-i(e);
dislay_l5d($,1,=,H!G=);
l5d@rint(sta6e-e();
dislay_l5d(&,1,=H=);
l5d@rint(-e(_5);
l5d@+rite((uint8_t)$);
>
52an6e_te((sta6e-e(,%_te(,L_te();
u(_rest(sta6e);
i+ (u(4est""1alse)'.7_%3!-();
i+ (sta6e""&)<
i+(sta6e-i(e<last(inute)<
2o_add();
>
>
quit_(ode (auto3nter);
>
>
v!id #et_sta#e_settin#s (v!id)
<
sta6e-e( " +ord(33'4O8@read(te(%!ddr),33'4O8@read(te(L!ddr));
sta6e-e( " sta6e-e(416@$;
i+ (resu(e)< // on the start o% resume gets saved time
sta6e-i(e"33'4O8@read(37);
resu(e " 1alse; // clears resume %or ne@t loop
>
else<
sta6e-i(e " 33'4O8@read(ti(e!ddr); // gets stage time
33'4O8@+rite(37,lo+Byte(sta6e-i(e));// saves the intial stage time
>
>
v!id add_'alt (v!id)
<
0oolean (alt;
l5d@5lear();
di6italWrite('u(,LOW);
di6italWrite(%eat,LOW);
dislay_l5d($,$,= !dd 8alt =);
Bu**er(3);
dislay_l5d($,1,= OA Duit=);
+ait_1or_5onFr(((alt);
i+ ((alt""1alse)<
di6italWrite(%eat,LOW);
di6italWrite('u(,LOW);
l5d@5lear();
delay(5$);
(ain8enu"$;
auto3nter " 1alse;
>
>
v!id re'!ve_'alt (v!id)
<
0oolean (alt;
l5d@5lear();
# " &; // used add to stage count on the >nal stage %or the resume
33'4O8@+rite(36,lo+Byte(#)); // stores the stage number %or the resume
di6italWrite('u(,LOW);
di6italWrite(%eat,LOW);
dislay_l5d($,$,= 4e(o"e 8alt =);
Bu**er(3);
dislay_l5d($,1,= OA Duit=);
+ait_1or_5onFr(((alt);
i+ ((alt""1alse)<
sta6e-i(e " 33'4O8@read(4$);
33'4O8@+rite(37,lo+Byte(sta6e-i(e));
di6italWrite(%eat,LOW);
di6italWrite('u(,LOW);
l5d@5lear();
delay(5$);
(ain8enu"$;
auto3nter " 1alse;
>
>
v!id #et_$!il_settin#s (v!id)
<
n(0r%os " 33'4O8@read(3&);
i+ (resu(e)<
i+(#0"&)<
sta6e-i(e " 33'4O8@read(4$);
>
else<
sta6e-i(e" 33'4O8@read(37);
>
>
else<
sta6e-i(e " 33'4O8@read(4$);
33'4O8@+rite(37,lo+Byte(sta6e-i(e));
>
2o!dd " 33'4O8@read(4&);
0l2!ddr " 2o!dd,41;
l5d@5lear();
2o-i(e " 33'4O8@read(0l2!ddr);
>
v!id 'anual_'!de (v!id)
<
load_id_settin6s();
ro(t_1or_+ater();
+ait_1or_5onFr(((anualLoo);
.hile ((anualLoo)< // manual loop
-e(erature();
dislay_l5d($,$,= 8anual 8ode =);
dislay_l5d($,1,=,H!G=);
l5d@rint((set_te();
dislay_l5d(&,1,=H=);
l5d@rint(-e(_5);
l5d@+rite((uint8_t)$);
52an6e_te(((set_te(,12$,2$);
quit_(ode((anualLoo);
2eat_5ontrol();
u(_5ontrol();
i+ ((2eat)<
'.7_%3!-();
>
>
>
v!id aut!_'!de (v!id)
<
load_sta6e_settin6s();
load_id_settin6s();
52e5A_1or_resu(e();
i+(0(resu(e))< // i% starting a ne& process prompt %or &ater
ro(t_1or_+ater();
+ait_1or_5onFr((auto3nter);
i+(0(auto3nter))return;
u(_ri(e();
33'4O8@+rite(4&,$);
# " $;
>
i+ (auto3nter)< // mash steps
33'4O8@+rite(35,1);// auto mode started
+!r (int i " #;i < n(0r,t6s;i,,)<
33'4O8@+rite(36,lo+Byte(#)); // stores the stage number %or the resume
#,,; // used to count the stages %or the resume
te(4ea52ed " 1alse;
6et_sta6e_settin6s();
start_ti(e();
sta6e_loo(i);
i+ (0(auto3nter)) $rea7;
i+( i""$ (( auto3nter)< // at the end o% the mashIn step pauses to add grain
add_(alt();
i+ (0(auto3nter))$rea7;
>
i+(i""(n(0r,t6s31)(( auto3nter)< // at the end o% the last step pauses to
remove the malt pipe be%ore the boil
re(o"e_(alt();
i+ (0(auto3nter))$rea7;
>
Bu**er(1);
te(%!ddr ,"3; // increase stage addresses
te(L!ddr ,"3;
ti(e!ddr ,"3;
l5d@5lear();
>
>
// start o% the boil
i+(auto3nter)<
start_ti(e();
sta6e-e(" &)@$; // set the intital boil temp to A< deg c
te(4ea52ed " 1alse;
6et_0oil_settin6s();
sta6e_loo(&,12$,&4);
i+(auto3nter)< // >nishes the bre&ing process
dislay_l5d($,$,= Bre+in6 =);
dislay_l5d($,1,= Binis2ed =);
Bu**er(3);
delay(2$$$);
33'4O8@+rite(35,$); // sets auto start byte to %or resume
33'4O8@+rite(4&,$); // sets hop count to
(ain8enu"$;
auto3nter "1alse;
resu(e "1alse;
>
>
>
v!id save_settin#s (int addr,int data)
<
33'4O8@+rite(addr,2i62Byte(data));
33'4O8@+rite((addr,1),lo+Byte(data));
>
v!id save_settin#s (int addr,0yte data)<
33'4O8@+rite(addr,data);
>
int chan#e_set(int( set_52an6e,int uer_li(it,int lo+er_li(it,int ste_si*e)
<
// Increase set temp
i+ (Button_reeat(Button_u))<
set_52an6e,"ste_si*e;
dislay_l5d($,1,= =);
>
i+ (set_52an6e > uer_li(it)set_52an6e " uer_li(it;
// decrease temp
i+ (Button_reeat(Button_dn))
<
set_52an6e3"ste_si*e;
dislay_l5d($,1,= =);
>
i+ ( set_52an6e < lo+er_li(it) set_52an6e " lo+er_li(it;
>
int chan#e_set(0yte( set_52an6e,int uer_li(it,int lo+er_li(it,int ste_si*e)
<
// Increase set temp
i+ (Button_reeat(Button_u))<
set_52an6e,"ste_si*e;
dislay_l5d($,1,= =);
>
i+ (set_52an6e > uer_li(it)set_52an6e " uer_li(it;
// decrease temp
i+ (Button_reeat(Button_dn))
<
set_52an6e3"ste_si*e;
dislay_l5d($,1,= =);
>
i+ ( set_52an6e < lo+er_li(it) set_52an6e " lo+er_li(it;
>
v!id unit_set (v!id)
<
int ara(9: "<
1$$,31$$,1,1$$,31$$,1,1$$,31$$,1,5$$$,5$$,5$$,&,1,1,),$,1 >;
int a " $;
0oolean idLoo " 1alse;
int id,et,setaddr;
int +indo+,i*e,et;
char& set;a(e9: "<
=/ G =,=/i G =,=/d G =,=Windo+si*eG =,=;u( o1 ,ta6esG=,=;u( o1 %osG=
>;
setaddr " $;
+!r(int i"$;i<6;i,,)<
i+((i>"$) (( (i<"3))<
i+ (i""3) setaddr " 33;
id,et"+ord(33'4O8@read(setaddr),33'4O8@read((setaddr,1)));
>
i+ (i""4)setaddr " 3);
i+((i>"4) (( (i<6))<
id,et" 33'4O8@read(setaddr);
>
idLoo" true;
dislay_l5d($,1,= =);
.hile (idLoo)<
dislay_l5d($,1,set;a(e9i:);
l5d@rint(id,et);
52an6e_set(id,et,ara(9a:,ara(9a,1:,ara(9a,2:);
quit_(ode(idLoo);
i+ (0(idLoo))i"6;
i+(Button_2old_ress(Button_n#t))<
i+ (i >" 4)<
sa"e_settin6s(setaddr,lo+Byte(id,et));
idLoo " 1alse;
>
else<
sa"e_settin6s(setaddr,id,et);
idLoo " 1alse;
>
>
>
i+ (i>"4)<
setaddr,"1;
>
else<
setaddr,"2;
>
a,"3;
>
>
v!id set_sta#es (v!id)
<
0oolean autote(Loo " 1alse;
0oolean autoti(eLoo " 1alse;
te(%!ddr " 6;
te(L!ddr " 7;
ti(e!ddr " );
%!at st6t(,et;
int st6t(,et+ord;
int st6ti(,et;
n(0r,t6s " 33'4O8@read(3));
+!r (int i"$; i<n(0r,t6s;i,,)< // loops %or the number o% stages
st6t(,et " +ord(33'4O8@read(te(%!ddr),33'4O8@read(te(L!ddr));
st6t(,et " st6t(,et416@$;
autote(Loo " true;
.hile (autote(Loo)< // loops %or temp adBust
dislay_l5d($,1,st6;a(e9i:);
l5d@rint(=-e(G=);
l5d@rint(st6t(,et);
quit_(ode(autote(Loo);
i+ (autote(Loo "" 1alse)<
return;
>
52an6e_te((st6t(,et,)5,2$);
i+ (Button_2old_ress(Button_n#t))<
st6t(,et " st6t(,et&16;
st6t(,et+ord "+ord(st6t(,et);
sa"e_settin6s(te(%!ddr,st6t(,et+ord);
dislay_l5d($,1,= =);
autote(Loo " 1alse;
>
>
autoti(eLoo " true;
st6ti(,et " 33'4O8@read(ti(e!ddr);
.hile (autoti(eLoo)< // loops to adBust time setting
dislay_l5d($,1,st6;a(e9i:);
l5d@rint(= ti(eG=);
l5d@rint(st6ti(,et);
quit_(ode(autoti(eLoo);
i+ (autoti(eLoo "" 1alse)<
return;
>
52an6e_set(st6ti(,et,12$,$,1);
i+ (Button_2old_ress(Button_n#t))<
sa"e_settin6s(ti(e!ddr,lo+Byte(st6ti(,et));
dislay_l5d($,1,= =);
autoti(eLoo " 1alse;
>
>
te(%!ddr," 3;
te(L!ddr," 3;
ti(e!ddr," 3;
>
>
v!id set_h!-s (v!id)
<
0oolean 2oLoo " 1alse;
0l2!ddr " 4$;
0yte 2o,et;
n(0r%os " 33'4O8@read(3&);
n(0r%os,"1;
+!r(int i "$;i<n(0r%os;i,,)<
2oLoo " true;
2o,et " 33'4O8@read(0l2!ddr);
.hile (2oLoo)<
i+ (i""$)<
dislay_l5d($,1,=Boil ti(e G =);
l5d@rint(int (2o,et));
>
else<
dislay_l5d($,1,=%o =);
l5d@rint(i);
l5d@rint(= ti(e G =);
l5d@rint(int(2o,et));
>
quit_(ode(2oLoo);
i+( 2oLoo "" 1alse)<
return;
>
52an6e_set(2o,et,1)$,$,1);
i+ (Button_2old_ress(Button_n#t))<
sa"e_settin6s(0l2!ddr,2o,et);
l5d@setCursor($,1);
l5d@rint(= =);
2oLoo " 1alse;
>
>
0l2!ddr," 1;
>
>
v!id aut!_set(v!id)
<
set_sta6es();
set_2os();
>
v!id setu-_'!de (v!id)
<
0yte setu8enu " $;
0oolean setuLoo " true;
.hile (setuLoo)<
s.itch (setu8enu)< // to select bet&een +I; and "uto menu
case($)9
dislay_l5d($,$,=Init 'ara(eters =);
dislay_l5d($,1,= =);
quit_(ode(setuLoo);
i+ (Button_2old_ress(Button_u))setu8enu " 1;
i+ (Button_2old_ress(Button_n#t))unit_set();
$rea7;
case(1)9
dislay_l5d($,$,= !uto 'ara(eters=);
dislay_l5d($,1,= =);
quit_(ode(setuLoo);
i+ (Button_2old_ress(Button_dn))setu8enu " $;
i+ (Button_2old_ress(Button_n#t))auto_set();
$rea7;
>
>
>
v!id setu-()
<
// Start up the library
l5d@0e6in(16,2);
in8ode (Button_u,.;'I-);
in8ode (Button_dn,.;'I-);
in8ode (Button_re",.;'I-);
in8ode (Button_n#t,.;'I-);
in8ode (%eat,OI-'I-);
in8ode ('u(,OI-'I-);
in8ode (Bu**,OI-'I-);
+indo+,tart-i(e " (illis();
//tell the +I; to range bet&een and the %ull &indo& siCe
(y'.7@,et8ode(!I-O8!-.C);
// &rite custom symbol to ,C;
l5d@5reateC2ar($,de65);
>
v!id l!!-()
<
s.itch((ain8enu)<
case (1)9
dislay_l5d($,$,= 8anual 8ode =);
dislay_l5d($,1,= =);
delay (1$$$);
l5d@5lear();
(anual_(ode();
(ain8enu " $;
$rea7;
case (2)9
dislay_l5d($,$,= !uto 8ode =);
dislay_l5d($,1,= =);
delay (1$$$);
l5d@5lear();
auto_(ode();
(ain8enu " $;
$rea7;
case (3)9
dislay_l5d($,$,= ,etu 8ode =);
dislay_l5d($,1,= =);
delay (1$$$);
l5d@5lear();
setu_(ode();
(ain8enu " $;
$rea7;
de+ault9
di6italWrite(%eat,LOW);
di6italWrite('u(,LOW);
-e(erature();
dislay_l5d($,$,= -2e Brauduino =);
dislay_l5d($,1,= -e(G=);
l5d@rint(-e(_5);
l5d@+rite((uint8_t)$);
i+ (Button_1se5_ress(Button_dn))(ain8enu " 1;
i+ (Button_1se5_ress(Button_re"))(ain8enu " 2;
i+ (Button_1se5_ress(Button_n#t))(ain8enu " 3;
$rea7;
>
>