Could I ask for some help please troubleshooting the above error.
line 22 in main.py
code here:
https://pastebin.com/urwKuKnZ
and module here
https://pastebin.com/urwKuKnZ
line 49
Thank you
Hi.
You shared the same link twice.
I didn’t receive your main.py file.
Regards,
Sara
Hello Sara,
It was kinda late and I had been trying to work it out myself for quite some time.
Try this
https://pastebin.com/Z6rqg7Mk
Thank you
Steve
Is everything working now?
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara
Hello Sara
Thank you for the follow-up.
I have not had the chance to pick this project up again but once I do I’ll make a note here if all’s good
or raise a new question
Seasons Greetings
Steve
Hi Again
I made it beyond that error to:
File “main.py”, line 22, in <module>
AttributeError: ‘module’ object has no attribute ‘ONCE_HIRES_1’
Looking at main.py and bh1750.py I THINK I can begin to see what’s wrong but I don’t yet, know how to sort it.
Regards
Steve
Hi.
I’m sorry for taking so long to get back to you.
What does your code look like at the moment?
Did you double-check that you have loaded the library properly?
Regards,
Sara
Hi Sara
No worries with the slow response.
Immediately after my previous post regarding the AttributeError:
‘module’ object has no attribute ‘ONCE_HIRES_1’
I messed around with the code to see if I could effect a change and when that didn’t work out I put it it to one side over the break.
Picking it up again this evening I was initially unable to repeat the problem.
I was getting a string of errors in the module for the ssd1306
So I hashed out the lines relating to the SSD1306 in main.py.
‘module’ object has no attribute ‘ONCE_HIRES_1’
now appears
I think this points to line 19 in the bh1750.py module:
https://pastebin.com/urwKuKnZ
The modified main.py file is here:
https://pastebin.com/sayNF0DC
NOTE. I fully appreciate this will not work. Its not complete
My thinking is; To get as far as getting the data off the bh1750 I can the move on to getting it to display on the ssd1306.
My next step will be to print the value of lux in the REPL then move on to showing it on a ssd1306.
Thank you
Steve
Hello Sara
Here it is.
https://github.com/PinkInk/upylib/blob/master/bh1750/bh1750/__init__.py
Thank you
Steve
Hi.
I think this line should be (BH1750 because it’s the class of the library and not the library itself)
lux=light.luminance(BH1750.ONCE_HIRES_1) ## Sample luminance in lux
Take a look at the example provided: https://github.com/PinkInk/upylib/blob/master/bh1750/test.py
I hope this helps.
Regards,
Sara
Hi
Sadly I have not been able to progress any further.
Maybe I have bitten off more than I can learn.
My idea had been to use the reading(s) from the BH1750 in conjunction with a PIR to trigger an alert (only) during the day with the addition of turning outside lights on at night.
I am going to put put the idea aside for the time being and work on some other I2C projects. There are 2 in MicroPython Programming with….
Can you suggest any others?
Thank you for your help.
Happy New Year
Steve
Hi.
You said “There are 2 in MicroPython Programming with….
Can you suggest any others?”
I’m sorry, but I didn’t understand your question. Can you reformulate it?
Regards,
Sara
Hi,
Apologies, my message was incomplete.
I was enquiring about other courses relating specifically to Micropython.
BUT
I have since found Ruis’s mail-out – dated 19th Aug last entitled
9 MicroPython Guides: Sensors/Modules with the ESP32/ESP8266.
Which, I think, will keep me going.
Regards
Steve
We only have one eBook about MicroPython with the ESP32: https://randomnerdtutorials.com/micropython-programming-with-esp32-and-esp8266/
We also have several free ESP32 and ESP8266 MicroPython tutorials. You can check them all here: https://randomnerdtutorials.com/projects-esp32-esp8266-micropython/
Let me know if you need further help.
Regards,
Sara