Sure, a year ago I was pretty confused about this myself, which was why I tried to document it in my installation guide. But I made an unwarranted assumption. I omitted to document sufficiently clearly the need to install the Unix build of MicroPython, which is necessary to run upip. I'll remedy this.nikhiledutech wrote: ↑Tue Jan 02, 2018 4:59 amI think this is the same problem which you too faced while py board...
STM32F407Disc : Write data on LCD
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: STM32F407Disc : Write data on LCD
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 118
- Joined: Wed Dec 27, 2017 8:52 am
Re: STM32F407Disc : Write data on LCD
Yeah. Currently i want to print a variable whose value is changing continuously, like say ADC O/P. If i want to print this variable on LCD, how can i print it using your code. Or what changes i need to do , to print it on LCD.
But as variable is in quotes it takes it as string. Can you help me in displaying variable on LCD.
Thanks
lcd[0] = 'x'.format(secs)import uasyncio as asyncio
import utime as time
from alcd import LCD, PINLIST
lcd = LCD(PINLIST, cols = 16)
x =1234
async def lcd_task():
for secs in range(20, -1, -1):
lcd[0] = 'x'.format(secs)
lcd[1] = "Solutions ".format(secs)
await asyncio.sleep(1)
loop = asyncio.get_event_loop()
loop.run_until_complete(lcd_task())
But as variable is in quotes it takes it as string. Can you help me in displaying variable on LCD.
Thanks
Re: STM32F407Disc : Write data on LCD
in 'x'.format(secs) x is the format specifier. Try '{}'.format(secs), or if you like a fixed width, '{:3}'.format(secs). For all details of Format specifiers, look into the Python manuals. https://pyformat.info/ or https://docs.python.org/3.1/library/string.html
-
- Posts: 118
- Joined: Wed Dec 27, 2017 8:52 am
Re: STM32F407Disc : Write data on LCD
Yeah. Thanks. Got it.
Now i have modified the code little bit to print a variable.
Now the variable gets printed on LCD as A 1234. I guess its the right way.
Thanks
Now i have modified the code little bit to print a variable.
lcd = LCD(PINLIST, cols = 16)
async def lcd_task():
A = 1234
lcd[0] = 'A {}'.format(A)
lcd[1] = "Solution"
await asyncio.sleep(1)
loop = asyncio.get_event_loop()
loop.run_until_complete(lcd_task())
Now the variable gets printed on LCD as A 1234. I guess its the right way.
Thanks