#MeasureDisplay

1 messages ยท Page 1 of 1 (latest)

fathom thicket
#

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

summer flower
#

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

summer flower
#

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?

fathom thicket
#

6

summer flower
#

The string "6", or 6 digits?

#

Is us100.distance an integer, or a floating point number?

fathom thicket
#

That would be string since I convert a number to str and that number is 999.88

summer flower
#

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

fathom thicket
#

Blank box on screen

summer flower
#

What you just posted doesn't show any of the changes

#

Actually, it shows the dummy_* things, but in the wrong place.

fathom thicket
summer flower
#

Can you tell me what's still wrong?

#

I mean, look at your code and tell me why it doesn't work

fathom thicket
#

No display of the ultrasonic sensor distance

summer flower
#

What's wrong with the label.Label call?

fathom thicket
#

it passes the dummy_test filled with text and space

summer flower
#

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?

fathom thicket
#

yes

summer flower
#

right. Q: What's wrong with the very last line?

fathom thicket
#

got me, a ;

summer flower
#

What is text_area.text being set to?

fathom thicket
#

oh s

#

it is being set to the value of the sendoe

#

sensor

summer flower
#

It should be getting set to text from the line right above it.

fathom thicket
#

test_area.text = text

summer flower
#

Bingo!

fathom thicket
#

That is it Way better than the examples

#

and I can walk around measuring stuff!

summer flower
#

Good luck!

#

this stuff does get easier, I promise

fathom thicket
#

Thanks Rimwolf! I can only hope but at my age maybe not.

summer flower
#

How old are you? (I'm guessing I'm older)

fathom thicket
#

72

summer flower
#

ok, same age, for another 10 days

#

(I'm retired from a whole career of stuff like this, though)

fathom thicket
#

Oracle programmer, now circuit board design and embedded MCU stuff with CAT M1 to keep busy

summer flower
#

"CAT M1"?

fathom thicket
#

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.

summer flower
#

compiler? (That means a piece of software to me) Sounds interesting

#

Just googled CAT M1 -- I'd never heard of it

fathom thicket
#

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.

summer flower
#

Ah. C and/or C++, I presume?

fathom thicket
#

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.

summer flower
#

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?

fathom thicket
#

Doesn't everyone? Look at the STM32MP157 dual ARM 7 at 800Mhz with an M4F for DSP

summer flower
#

๐Ÿ™‚ 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

fathom thicket
#

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.

summer flower
#

Is that a job, a hobby, or somewhere in between, if I may ask?

fathom thicket
#

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...

summer flower
#

Nice! I have not (yet) had the chance to fly a drone.