#MeasureDisplay
1 messages ยท Page 1 of 1 (latest)
terminalio.FONT, color=0xFFFFFF, x=28, y=HEIGHT // 2 - 1, text = "DIST:" + dist that works, I can see the DIST on the display but no while loop while True:
Draw a label
dist = str(us100.distance)
text = "DIST:" + dist
text_area.text
Please post your code starting with the dummy_value= line. Surround it with back-ticks, the things that look like apostrophes but slant to the left. (On my keybard it's the character below the ~, on the upper row left of the 1 key.)
Three back-ticks, newline, paste your code, new line, three more back-ticks
Or just upload your program to the same place as before, whatever works
This seems faster this way.
OK, you're missing the setting of the dummy value, missing the text parameter inside the label.Label call, and the last line should set text_area.text to text
The dummy value is important, because whatever is set as the value of text in the label.Label call will allocate screen space for just as many characters as are in that text value. That's why the dummy value has to be longer (in character count than any string you would get from dist inside the True loop.
The way the code is currently written, there's no room for any characters at all.
What is str(us100.distance) going to look like, for the largest value you expect?
6
The string "6", or 6 digits?
Is us100.distance an integer, or a floating point number?
That would be string since I convert a number to str and that number is 999.88
ok, so change the first line under # Draw a label to
dummy_dist = "999.88"
Then right after it, add the line
dummy_text = "DIST: " + dummy_dist
Then, inside the parentheses of the label.Label call, replace the value of the text parameter with dummy_text.
Then the very last line should be
text_area.text = text
Blank box on screen
What you just posted doesn't show any of the changes
Actually, it shows the dummy_* things, but in the wrong place.
try again - it worked this time
Can you tell me what's still wrong?
I mean, look at your code and tell me why it doesn't work
No display of the ultrasonic sensor distance
What's wrong with the label.Label call?
it passes the dummy_test filled with text and space
Yeah, it's actaully ok, just some formatting problems.
Why are dummy_dist and dummy_text inside the while True loop? (I missed that they were also above)
Q: can they be deleted?
yes
right. Q: What's wrong with the very last line?
got me, a ;
What is text_area.text being set to?
It should be getting set to text from the line right above it.
test_area.text = text
Bingo!
Thanks Rimwolf! I can only hope but at my age maybe not.
How old are you? (I'm guessing I'm older)
72
ok, same age, for another 10 days
(I'm retired from a whole career of stuff like this, though)
Oracle programmer, now circuit board design and embedded MCU stuff with CAT M1 to keep busy
"CAT M1"?
Did I mention the Rowley compiler I purchased last week... LTE CAT M1 IOT very low band width devices that take very little power but can work where ever phones work, $5 a month plans at low numbers, way cheaper than Satellite.
compiler? (That means a piece of software to me) Sounds interesting
Just googled CAT M1 -- I'd never heard of it
ARM bare metal compiling for MCU devices - Check out the Artemis Sparkfun MCU 6ua stuff. The F405 Feather is using .03Ah running that OLED and sensor.
Ah. C and/or C++, I presume?
CrossStudio Rowley, C/C++ ASM with the ability to import IAR and Keil projects plus they can now compile/build from Arduino ino projects then debug them.
Sounds interesting. I've thought that something like the Teensy 4.1 (600MHz Arm Cortex-M7) would be a great platform for music synth stuff -- lots of heavy DSP for some of the more interesting synth techniques
So you have C/C++ in your background?
Doesn't everyone? Look at the STM32MP157 dual ARM 7 at 800Mhz with an M4F for DSP
๐ Yeah, I actually spent a couple of decades writing compilers & related software development tools in C
Noted re the STM32 chip
Then Python and Java came along
Then you would enjoy CrossStudio, fast and not cluttered. When Java came out I was already into PHP for the back-end with the Databases, I left the user interfaces for the graphic people. My C/C++ skills are hit and miss over the years, going to dive in again for the M1 + Apollo project hence the CrossStudio purchase.
Is that a job, a hobby, or somewhere in between, if I may ask?
Hobby to pass time, less expensive than motorcycle or boating and a lot safer. I am the water manager for a irrigation company during the summer, the devices measure water usage and monitor the reservoir for issues. The fun part is flying drones looking for rodents...
Nice! I have not (yet) had the chance to fly a drone.