duino-coin icon indicating copy to clipboard operation
duino-coin copied to clipboard

AVR ERROR : local variable 'num_res' referenced before assignment

Open Doofus4ever opened this issue 5 years ago • 7 comments

When i uploaded new code to deal with connecting error i get the error: local variable 'num_res' referenced before assignment

To recreate:

  • load new code to Adruino Mega2560.
  • Use AVR MINER 2.72
  • and you will get the error : local variable 'num_res' referenced before assignment

see image of errors mega2560_num_res_error

Doofus4ever avatar Sep 08 '21 17:09 Doofus4ever

Hello, generally these error appears when the arduino doesn't return the values to the AVR_miner, can you enable the debug with debug = y on the Miner_config.cfg file and send another print please

gsrbr avatar Sep 08 '21 20:09 gsrbr

For some reason its not showing that error but another see pic:

arduino_Mega2560_Error2

Doofus4ever avatar Sep 08 '21 22:09 Doofus4ever

Definitivaly this are estrange... I don't know if this it's a issue from the code or if this are a issue into your MEGA, because sometimes your mega give a wrong answer format and somethimes a correct answer format: mega_issue Note: these communications error can ocasionate the first issue too local variable 'num_res' referenced before assignment

Unfortunately I don't have a mega to be able to test this further... but this is definitely weird...

Try to reload the code to your arduino, and test again please

gsrbr avatar Sep 08 '21 22:09 gsrbr

i have done it about 5 times still does the same thing my mega is the elegoo R3 Mega2560: https://www.amazon.com/ELEGOO-ATmega2560-ATMEGA16U2-Projects-Compliant/dp/B01H4ZLZLQ/ref=sr_1_4?dchild=1&keywords=elegoo+mega+2560&qid=1631142375&sr=8-4

https://m.media-amazon.com/images/I/71oqDmr3zKS.AC_SX679.jpg

Doofus4ever avatar Sep 08 '21 23:09 Doofus4ever

seems like the avr_timeout is too short, avr_miner read half way and got cut off. can you try edit Miner.cfg to increase the timeout? avr_timeout = 10

JK-Rolling avatar Sep 09 '21 00:09 JK-Rolling

After increasing timeout to 10 seconds its shows that 'num_res' error and other errors please see pic arduino_Mega2560_Error3

Doofus4ever avatar Sep 09 '21 02:09 Doofus4ever

its working fine now i increased timeout to 20 seconds its now working perfectly thanks for you help

Doofus4ever avatar Sep 09 '21 03:09 Doofus4ever