How can I make my LED glow using python code from ubuntu server

Hello,
How can I make my LED glow using python code from the ubuntu server?
The LED is connected to Bolt WiFi Module.
and when the python program runs the led should turn on and off alternatively after 10 seconds.

run this program on ubuntu server using putty by typing ip address on putty software then type ‘python’ and copy paste this program

from machine import Pin
import time

led = Pin(0, Pin.OUT) //this is digital pin 0
for i in range(10):
    led(1)// LED ON
    time.sleep_ms(10000)//10 sec
    led(0)//LED OFF
    time.sleep_ms(10000)//10 sec
1 Like

Hi dagdih,
I hope you have already installed a ubuntu server in your virtual machine.Create a python programmable file and paste the below code.

import time
from boltiot import Bolt
API="XXXXX"                  # give your API key
DEVICE_ID="XXXXXXXX"   #provide your device id
mybolt=Bolt(API,DEVICE_ID)
while 1:
  mybolt.digitalWrite('0','HIGH')
  time.sleep(10)
  mybolt.digitalWrite('0','LOW')
  time.sleep(10)

run this program on your ubuntu server. feel free to ask any further queries

1 Like