Code Monkey home page Code Monkey logo

rpi's Introduction

USEFUL CODE

For raspberry pi projects.

2ircar.py Code for the 2 motor toy car that you can drive about. Has an IR LED sensor. Stops if it seems something. Best run in python 2.7

2ircarRoomba.py Similar to the code above except that it has an Auto mode. It drives itself, detects an object, then reverses. Tries again.

4rov.py Code to contol the 4 motor Breadboard rover using the keyboard. Best run in python3.

4rovBOARD.py Same as above except it uses the BOARD GPIO pin naming system instead of BCM.

4rovIR.py Same as above except with an Infrared (IR) sensor that tries to stop you hitting things.

4rovIR_AUTO.py Same as the IR rover above but with a Roomba Autosteer mode. Proper robot.

4rovULTRA.py Same as 4rovIR_AUTO.py above but upgraded to a longer range UltraSonic sensor instead of the IR sensor.

gpiotest.py Spins all 4 motors on the GPIO to test your motors are working correctly.

ultravelocity.py Uses the ultrasonic sensor to measure the velocity (the speed in a direction).

rpi's People

Contributors

dangerphysics avatar mrdmurray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi's Issues

Ultrasonic sensor

Need to get the ultrasonic sensor up. Anyone want to have a go at it?

Minor issue with rpi/Startup_IP_Mailer/How to set this up.txt

The startup emailer was just not working on my Raspberry Pi 3 running OctoPi (3D printer control software).

I found two reasons:

(1) OctoPi is installed on Raspian-Jessie-Lite, a stripped down version of the sofware. This OS lacks some of the files needed to do your "UPDATED METHOD FOR PIXEL NEW PI: 12 03 17" method of running at startup.

(2) So I had to go with the older "rc.local" method. I followed those instructions, but my R-Pi3 would not find and log onto the network. It turns out that the Pi was trying to send out the email before the Pi had finished logging on the the network. I fixed this by inserting sleep 15 into rc.local just before the sudo python /home/pi/startup_maily.py & command. It's been working without a problem since that change.

I'm sure there are more elegant solutions to adding sleep15 in item #2 above, but it got me up and running.

Thanks again for making this available! It has certainly simplified using the 3D printer attached to a Raspberry Pi3 in the classroom where I volunteer.

WaterTankSensor Questions

-You can probably use a piece of White Styrofoam to make sure proper reflection occurs
-What data does the Thingspeak upload? Is it the CSV file? If so, how does it receive the file in the code to upload to the web and how does the code create a CSV file:
#writes this data to a table (a .csv file), this is needed for the graph with open("cpu_dists.csv", "a") as log: # "a" means append to the end log.write("{0},{1}\n".format(strftime("%Y-%m-%d %H:%M:%S"),str(mode))) and the function:

`def updateThingSpeak(): #sends data to a webpage
   print('starting...') 
   baseURL = 'https://api.thingspeak.com/update?api_key=%s' % myAPI  


   try:
       print("The mode being sent to the web is " + str(mode) + "cm") 
       f = urlopen(baseURL + "&field1=%s" % (str(mode))) 
       print (f.read()) 
       f.close() 
       sleep(30) #uploads sensor values every 30 secs`
  • How does this for Loop, only take 10 Measurements if the variable is equal to 50? `number_of_readings = 50 #how many readings to take and find the mode of

    for pizza in range(number_of_readings): #takes 10 readings
    distance = distcheck() #checks distance
    readings_list.append(int(distance)) #puts the 10 values in a list`

-Is this code for getting the mathematical mode of all the readings? Is this the figure going to be shown in the CSV file? print(readings_list) #prints the list and gets the mode (most common value) mode = max(set(readings_list), key=readings_list.count) print("The mode of " + str(number_of_readings) + " values is " + str(mode))

-Finally, should the limit be the number the user inputted in the first place? It is set as <10 currently: limit=input("Set a limit in cm to trigger an email alert eg. 5 ") and if mode <10 and mailAlert == 1: #sends email if mode is <10cm send_mail_alert()

There is loads of cool things in the code that will help us out but using the CSV table and an iOT system, makes it a very powerful system altogether!

Daniel,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.