Toggle GPIO (mstickC)

I’m trying to toggle a GPIO on my m5stickC with micropython. (using ui-flow)
Following is my code,

from m5ui import *
from uiflow import *
from easyIO import *

setScreenColor(0x111111)

circle0 = M5Circle(40, 40, 25, 0xffffff, 0xffffff)

j = None

import BlynkLib
BLYNK_AUTH = 'xxxx'
blynk = BlynkLib.Blynk(BLYNK_AUTH)


@blynk.VIRTUAL_WRITE(4) # Button Widget on V4
def my_write_handler(value):
    if int(value) == 1:
	blynk.virtual_write(1)
    else:
	blynk.virtual_write(0)

if j == 1:
  digitalWrite(26, 1)
if j == 0:
  digitalWrite(26, 0)
  
while True:
  blynk.run()
  wait_ms(2)

Summarizing, how do I affect the “j” value from the virtual pin?

Thank you!

@akshaypatil please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like

Thank you! Just did that :slight_smile: