from machine import Pin, I2C, PWM, Timer from stepper import Stepper import utime as time pin_dir = Pin(14) pin_step = Pin(13) pin_en = Pin(0) steppy = Stepper(pin_en, pin_dir, pin_step) steppy.on() steppy.max_speed = 10000 steppy.acc = 5 for i in range(0, 1): steppy.target = steppy.deg_to_steps(360) while (steppy.pos != steppy.target): _ = steppy.run() #steppy.off() time.sleep(1.0) steppy.target = 0 while (steppy.pos != steppy.target): _ = steppy.run() #steppy.off() time.sleep(1.0) print("Done!") #pwm = PWM(pin_step) # #pwm.freq(1000)
# i2c = I2C(scl=pin_scl, sda=pin_sda, freq=100000) # compass = HMC5883L(i2c) # compass.offset_x = 400 # compass.offset_y = -45 # Connect to WiFi wifi_config = open('wificonfig.txt', 'r') my_ap = wifi_config.readline().rstrip() my_pw = wifi_config.readline().rstrip() wifi_config.close() wlan = network.WLAN(network.STA_IF) wlan.active(True) wlan.connect(my_ap, my_pw) for i in range(0, 60): # attempt to connect ip, mask, gateway, dns = wlan.ifconfig() if ip == '0.0.0.0': #not connected print('.') time.sleep(1) else: #connected! print('Got IP: ', ip) tle = sc.get_tle_from_url(sc.tle_src, 'ISS (ZARYA)') print(tle) while (True): (alt, az) = sc.get_alt_az_from_tle_and_location(tle, 'Berlin') print("ALT: {}\t AZ: {}".format(round(alt, 1), round(az, 1))) srv_deg(alt) # because direction is reversed steppy.target = steppy.deg_to_steps(az) while (steppy.pos != steppy.target): _ = steppy.run() time.sleep(3)