antitheft159 commited on
Commit
2b71e80
·
verified ·
1 Parent(s): 78d295a

Upload skyelahandriy_195.py

Browse files
Files changed (1) hide show
  1. skyelahandriy_195.py +33 -0
skyelahandriy_195.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """skyelahAndriy.195
3
+
4
+ Automatically generated by Colab.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1cStg9EvSGG9MQ3ObrBKuJb-7MTSfKD3f
8
+ """
9
+
10
+ import RPi.GPIO as GPIO
11
+ import ADC0834
12
+ from time import sleep
13
+ dt=.1
14
+ redPin=23
15
+ DC=0
16
+ GPIO.setmode(GPIO.BCM)
17
+ ADC0834.setup()
18
+ GPIO.setup(redPin,GPIO.OUT)
19
+ myPWM=GPIO.PWM(redPin,1000)
20
+ myPWM=start(DC)
21
+ try:
22
+ while True:
23
+ potVal=ADC0834.getResult(0)
24
+ DC=(100/255)*potVal
25
+ if DC>99:
26
+ DC=99
27
+ myPWM.ChangeDutycycle(DC)
28
+ print(potVal, DC)
29
+ sleep(dt)
30
+ except KeyboardInterrupt:
31
+ myPWM.stop()
32
+ GPIO.cleanup()
33
+ print('GPIO Ready to Perform')