Try change name of function or variable. At now they had the same names.
Maybe this construction will be work
@notdodgy, show me example input string, and write what exactly you need "extract" from this json string. Show me what string you except as output according to example input string. It is a some kind of homework?. I don't know why you make so many character substitutions in the text.
in python code you could use this construction:
out_str = in_str.replace('[', '').replace(']', '').replace...
but i dont tested yet how long may be replace chain.
You could use a python commands in REPL via serial port connection or execute block in UiFlow. These .py files should be placed in /apps folder in flash
import os # change directory and delete os.chdir("/apps") os.remove("example.py") # ewentually delete with full path os.remove("/apps/example.py") # print file list of actual directory print( os.listdir() )
@Werner_G, probably there is a problem with remote control. In this thread is a post about it
def translate(slider_value, inMin, inMax, outMin, outMax): return (slider_value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin def slider_Motor_callback(slider_value): motion = Motion() motion.set_motor_speed(1, translate(slider_value, 0, 100, -127, 127) )
The problem is finding the atom lite schematic. It is not clear what voltage stabilizer was used. I suspect it has a voltage drop between input and output of ~1.0-1.2V. I connected a li-po cell (4.2V 900mAh) directly into the 5V input. I measured the cell voltage and sent the data to the local blynk server every 20 seconds. Additionally, I measured the internal temperature of the esp32 chip and it oscillated at a constant 50-51°C. With this connection the chip worked for about 6.5 hours and then turned off or stopped working properly at 3.41±0.1V cell voltage. So the esp32 chip probably stopped working at ~2.2-2.4V on a 3.3V supply line. I don't know how usb-uart converter will work with supply voltage lower than 5V. A colleague from "Esp Poland" forum tested power supply for ws2812 diode and at 3.9V the diode went crazy.
Screenshot from blynk contain:
Hey, the problem of your button handler function is its duration (a good 6 seconds if not more). The problem will be when you call that function again before it finishes its previous action. Uiflow is also a bit weird in automatically generating code based on blocks. And for example all variables declared in functions and callbacks are generated as global variables, not as local as it would look from block vizualization.
And now your key handler function runs and sets a control variable (global) then conditions its further action on this variable.
In the meantime you run a second instance of the "same" function which suspends the first one and now this second instance of the function changes the values of your variables (global) which after the end of this instance of the function will still be used by the previously called function. Alternatively, the action of this second function will be determined by what variables were changed by the first function call.
You can check at the very beginning of the function if the variable is_running (example name) is True, if so, exit the function. Then you set is_running to true, then your code and at the very end of your code in the function you set is_running to false. Then next execution of this function during previous one will break it.
Something like this
# initial value of semafor # put below line at begining # of your program is_running = False # put this inside your function if is_running: return else: is_running = True # insert # your code # here is running = False
You must also find what other deviced are builtin (like gyroscope, microphone, buttons leds) and what gpio pins they used.
Link to Uiflow handbook. You must find file quickblockref.pdf
On this site you have information which pins you can use as input/output adc input/dac output
I made custom block for uiflow for do this. But i implemented use only one sensor per gpio pin without checking crc errors (shorter and simplicity code).
and here is python code used in this custom block:
Try connect sensor to SDA pin in groove port, but you must find a number of gpio pin assigned for this line.
You also should connect a pullup resistor (2-10kohm) betwen sensor DQ pin and sensor Vcc. In my case i use ds18b20 without this resistor, but my connection to sensor is shorter than 10cm.
I have question. Anybody dissassembled atom and know what type of voltage regulator are used?. I try powered atom directly from lipo battery connected to 5V pin and works approx 3-4 hours (900mAh capacity). i check battery voltage and multimeter shows 3.6V. So there is enough energy to power atom. But i guess these input voltage is to low for normal work a LDO.
Its seems M5stickC Plus which have screen with greater resolution that M5StickC. Maybe you need or update a new m5stick libraries to use with bigger screen. Ewentually look into source files of library and find const/vars with screen resolution, maybe they are hardcoded.