Closed ilovetogetspamed closed 4 years ago
Sorry for the delay in following up.
I see you are using uppercase names for your custom user functions. Bitlash internally compares names in all lower case. What happens if you use lowercase function names in the addBitlashFunction calls?
This would not explain your issue with timer1, which I am still pondering.
Kind regards,
-br
On Sep 25, 2019, at 8:43 PM, cfo64nc notifications@github.com wrote:
Please Help! I thought I was writing my functions properly. Also, example "timer1" doesn't work either. I'm using an Authentic Arduino Mega2560 R3.
I/O
bitlash here! v2.0 (c) 2013 Bill Roy -type HELP- 6044 bytes free
print needle()
--------------^ unexpected number
print NEEDLE()
--------------^ unexpected number
echo(100,1,"Spam, Spam Spam", 42) 100 1 Spam, Spam Spam 42 print timer1(), timer1(), timer1()
--------------^ unexpected number Code
if defined(ARDUINO) && ARDUINO >= 100
include "Arduino.h"
else
include "WProgram.h"
endif
include "bitlash.h"
include "../bitlash/src/bitlash.h" // for sp() and printInteger()
numvar func_NEEDLE(void) { return analogRead(A8); }
// The ECHO() function echoes back its arguments for debugging, with proper handling for strings numvar func_ECHO(void) { for (int i=1; i <= getarg(0); i++) { if (isstringarg(i)) sp((const char *) getstringarg(i)); else printInteger(getarg(i), 0, ' '); speol(); } }
numvar timer1(void) { return TCNT1; // return the value of Timer 1 }
void loadBitlashFunctions() { addBitlashFunction("ECHO", (bitlash_function) func_ECHO); // The ECHO() function echoes back its arguments, \ with proper handling for strings addBitlashFunction("NEEDLE", (bitlash_function) func_NEEDLE); addBitlashFunction("timer1", (bitlash_function) timer1); }
void setup(void) { initBitlash(57600); // must be first to initialize serial port loadBitlashFunctions(); }
void loop(void) { runBitlash(); } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/billroy/bitlash/issues/61?email_source=notifications&email_token=AAAX5RWK67DGZF6OQF3IKCTQLQOU7A5CNFSM4I2UHHX2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HNYLVXA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAX5RQ6742C5NV34FDDHJTQLQOU7ANCNFSM4I2UHHXQ.
Billroy,
I changed to lower case. That helped.
Chris
On Sep 27, 2019, at 6:52 PM, Bill Roy notifications@github.com wrote:
Sorry for the delay in following up.
I see you are using uppercase names for your custom user functions. Bitlash internally compares names in all lower case. What happens if you use lowercase function names in the addBitlashFunction calls?
This would not explain your issue with timer1, which I am still pondering.
Kind regards,
-br
On Sep 25, 2019, at 8:43 PM, cfo64nc notifications@github.com wrote:
Please Help! I thought I was writing my functions properly. Also, example "timer1" doesn't work either. I'm using an Authentic Arduino Mega2560 R3.
I/O
bitlash here! v2.0 (c) 2013 Bill Roy -type HELP- 6044 bytes free
print needle()
--------------^ unexpected number
print NEEDLE()
--------------^ unexpected number
echo(100,1,"Spam, Spam Spam", 42) 100 1 Spam, Spam Spam 42 print timer1(), timer1(), timer1()
--------------^ unexpected number Code
if defined(ARDUINO) && ARDUINO >= 100
include "Arduino.h"
else
include "WProgram.h"
endif
include "bitlash.h"
include "../bitlash/src/bitlash.h" // for sp() and printInteger()
numvar func_NEEDLE(void) { return analogRead(A8); }
// The ECHO() function echoes back its arguments for debugging, with proper handling for strings numvar func_ECHO(void) { for (int i=1; i <= getarg(0); i++) { if (isstringarg(i)) sp((const char *) getstringarg(i)); else printInteger(getarg(i), 0, ' '); speol(); } }
numvar timer1(void) { return TCNT1; // return the value of Timer 1 }
void loadBitlashFunctions() { addBitlashFunction("ECHO", (bitlash_function) func_ECHO); // The ECHO() function echoes back its arguments, \ with proper handling for strings addBitlashFunction("NEEDLE", (bitlash_function) func_NEEDLE); addBitlashFunction("timer1", (bitlash_function) timer1); }
void setup(void) { initBitlash(57600); // must be first to initialize serial port loadBitlashFunctions(); }
void loop(void) { runBitlash(); } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/billroy/bitlash/issues/61?email_source=notifications&email_token=AAAX5RWK67DGZF6OQF3IKCTQLQOU7A5CNFSM4I2UHHX2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HNYLVXA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAX5RQ6742C5NV34FDDHJTQLQOU7ANCNFSM4I2UHHXQ.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/billroy/bitlash/issues/61?email_source=notifications&email_token=AAY5THBLLXAE7RYESF6YAQLQL2FDNA5CNFSM4I2UHHX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD72IWTQ#issuecomment-536120142, or mute the thread https://github.com/notifications/unsubscribe-auth/AAY5THCLMX5VWOI35LKTRY3QL2FDNANCNFSM4I2UHHXQ.
changing my callback names to lower case worked.
BTW, timer1 was not an issue. I was using that as an 'extra' function call in my testing of your library.
Thanks for clearing up that loose end… I still didn’t have a theory on it.
Kind regards,
-br
On Sep 30, 2019, at 2:15 PM, cfo64nc notifications@github.com wrote:
BTW, timer1 was not an issue. I was using that as an 'extra' function call in my testing of your library.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/billroy/bitlash/issues/61?email_source=notifications&email_token=AAAX5RWVABGBCKWD5O4D3ILQMJM43A5CNFSM4I2UHHX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD766GEI#issuecomment-536732433, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAX5RTFFWPTKQAPWHBQXCLQMJM43ANCNFSM4I2UHHXQ.
Please Help! I thought I was writing my functions properly. Also, example "timer1" doesn't work either. I'm using an Authentic Arduino Mega2560 R3.
I/O
Code