arudini mega, cant work out all the flaws in my sketch
hi everyone
i trying program arudini mega 2560 reset sani solution cartriges catgenie 120 cant problems worked out of these sketches found online.
here sketch
and current error is
exit status 1
'resetcartridge' not declared in scope
#include <wire.h>
#define cg (b1010000)
boolean resetsuccess = false;
int isreset = 13;
int bytearray []= {01, 01, 01, 60, 60, 60, 60, 60, 60, 8, 8, 8, 33, 33, 33, 255};
void setup();
{ // initialize serial communication:
serial.begin(9600);
// initialize pins: pinmode(isreset, output);
digitalwrite(isreset, low);
wire.begin(); // join i2c bus (address optional master)}
void loop();
{ if (resetsuccess)
{ delay (2000); // our work done - pause while resetsuccess = false;
}
else
{ resetcartridge();
resetsuccess = verifycartridge();
digitalwrite(isreset, resetsuccess);
}
void resetcartridge()
{ (int i=3; < sizeof(bytearray)/2; i++)
{ wire.begintransmission(cg);
wire.send(i);
wire.send(bytearray);
wire.endtransmission();
delay(4);
}
}
void movepointerto(int deviceaddr, int memoryaddr)
{ wire.begintransmission(deviceaddr);
wire.send(memoryaddr);
wire.endtransmission();
}boolean verifycartridge()
{ boolean success = true;
movepointerto(cg, 3);
wire.requestfrom(cg, 3);
while (wire.available())
{ if (wire.receive() == 60 && success == true)
{ // looking far
} else { success = false; }
} return success;}
}
}
i trying program arudini mega 2560 reset sani solution cartriges catgenie 120 cant problems worked out of these sketches found online.
here sketch
and current error is
exit status 1
'resetcartridge' not declared in scope
#include <wire.h>
#define cg (b1010000)
boolean resetsuccess = false;
int isreset = 13;
int bytearray []= {01, 01, 01, 60, 60, 60, 60, 60, 60, 8, 8, 8, 33, 33, 33, 255};
void setup();
{ // initialize serial communication:
serial.begin(9600);
// initialize pins: pinmode(isreset, output);
digitalwrite(isreset, low);
wire.begin(); // join i2c bus (address optional master)}
void loop();
{ if (resetsuccess)
{ delay (2000); // our work done - pause while resetsuccess = false;
}
else
{ resetcartridge();
resetsuccess = verifycartridge();
digitalwrite(isreset, resetsuccess);
}
void resetcartridge()
{ (int i=3; < sizeof(bytearray)/2; i++)
{ wire.begintransmission(cg);
wire.send(i);
wire.send(bytearray);
wire.endtransmission();
delay(4);
}
}
void movepointerto(int deviceaddr, int memoryaddr)
{ wire.begintransmission(deviceaddr);
wire.send(memoryaddr);
wire.endtransmission();
}boolean verifycartridge()
{ boolean success = true;
movepointerto(cg, 3);
wire.requestfrom(cg, 3);
while (wire.available())
{ if (wire.receive() == 60 && success == true)
{ // looking far
} else { success = false; }
} return success;}
}
}
please use code tags (</> button on toolbar) when post code or warning/error messages. reason forum software can interpret parts of code markup (hence italics in code above), leading confusion, wasted time, , reduced chance problem. make easier read code , copy ide or editor. using code tags , other important information explained in how use forum post. please read it.
please tools > auto format on code before posting it. make easier spot bugs , make easier read. if you're using arduino web editor not have access useful tool. recommend use standard ide instead.
your practice of adding code after opening brace makes extremely difficult read. if trying make code more compact put opening brace on same line function signature, in style used arduino example sketches. otherwise put brace on line itself.
do tools > auto format , take close @ indentation. give excellent clues problems in code.
please tools > auto format on code before posting it. make easier spot bugs , make easier read. if you're using arduino web editor not have access useful tool. recommend use standard ide instead.
your practice of adding code after opening brace makes extremely difficult read. if trying make code more compact put opening brace on same line function signature, in style used arduino example sketches. otherwise put brace on line itself.
do tools > auto format , take close @ indentation. give excellent clues problems in code.
Arduino Forum > Using Arduino > Programming Questions > arudini mega, cant work out all the flaws in my sketch
arduino
Comments
Post a Comment