skyelahAndriy.195 / skyelahandriy_195.py
antitheft159's picture
Upload skyelahandriy_195.py
2b71e80 verified
raw
history blame contribute delete
649 Bytes
# -*- coding: utf-8 -*-
"""skyelahAndriy.195
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1cStg9EvSGG9MQ3ObrBKuJb-7MTSfKD3f
"""
import RPi.GPIO as GPIO
import ADC0834
from time import sleep
dt=.1
redPin=23
DC=0
GPIO.setmode(GPIO.BCM)
ADC0834.setup()
GPIO.setup(redPin,GPIO.OUT)
myPWM=GPIO.PWM(redPin,1000)
myPWM=start(DC)
try:
while True:
potVal=ADC0834.getResult(0)
DC=(100/255)*potVal
if DC>99:
DC=99
myPWM.ChangeDutycycle(DC)
print(potVal, DC)
sleep(dt)
except KeyboardInterrupt:
myPWM.stop()
GPIO.cleanup()
print('GPIO Ready to Perform')