Skip to content

Commit

Permalink
upload device control code and sensor code
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptoSalamander committed Jul 29, 2019
1 parent f07d40c commit 8097da9
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 145 deletions.
58 changes: 0 additions & 58 deletions pres_sensor/fsr402.dat

This file was deleted.

44 changes: 0 additions & 44 deletions pres_sensor/fsrtest.py

This file was deleted.

Binary file added robot_arm/.servo_select.c.swp
Binary file not shown.
14 changes: 14 additions & 0 deletions robot_arm/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <wiringPi.h>
#include <stdio.h>

int main(void){
wiringPiSetupGpio();
pinMode(17, PWM_OUTPUT);
pwmSetMode(PWM_MODE_MS);
pwmSetRange(2000);
pwmSetClock(192);
pwmWrite(18,150);
delay(1000);
pwmWrite(18,200);
return 0;
}
26 changes: 26 additions & 0 deletions sensor/sensor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import spidev, time, os

spi = spidev.SpiDev()
spi.open(0,0)

Vcc = 5.0
R1 = 1000

def fsr420_Registor(voltage):
R = (R1 * Vcc)/voltage - R1
return R

def analog_read(channel):
r = spi.xfer([1,(8+channel) << 4, 0])
adc_out = ((r[1]&3) << 8)+r[2]
return adc_out
try :
while True:
pres_value = analog_read(0)
vib_value = analog_read(1)
print "Pres_value:", pres_value, " vib_value:", vib_value
time.sleep(0.1)

except KeyboardInterrupt:
print "Now Exit"

File renamed without changes.
Binary file added sensor/temp_sensor/Adafruit_DHT.pyc
Binary file not shown.
File renamed without changes.
26 changes: 0 additions & 26 deletions vib_sensor/gpio_test.py

This file was deleted.

17 changes: 0 additions & 17 deletions vib_sensor/test.py

This file was deleted.

0 comments on commit 8097da9

Please sign in to comment.