Go to advanced search

by tom.slick
Thu Aug 04, 2016 6:57 am
Forum: Python
Topic: Conversion of Datatypes from received values
Replies: 12
Views: 2457

Re: Conversion of Datatypes from received values

Ok, so i've figured out my problem and what i need to do ti fix it. I'm using an nrf24L01 transceiver which is limited to 32 bytes. Thats why its wrapping around after 255. Can anyone help me send greater numbers than that? Maybe in packets? Which NRF24L01 libraries are you using? There are several...
by tom.slick
Mon Aug 01, 2016 6:31 pm
Forum: Python
Topic: WiringPi Python
Replies: 11
Views: 1763

Re: WiringPi Python

I get an error trying to use the int wiringPiSetup commands from Python, not sure why. I had been using GPIO.setmode(GPIO.BCM) to set the mode to BCM pin numbers after importing the RPiGPIO module in Python. Can I use GPIO.setmode to set to the wiringPi pin numbers instead? What error? import wirin...
by tom.slick
Mon Aug 01, 2016 7:23 am
Forum: Python
Topic: Slither Game
Replies: 4
Views: 946

Re: Slither Game

The actual way to do it so that it did the print om nom nom was to correct misplaced ( ) You did not ask about that, you asked about your red block not being on the screen. What does displaying "om nom nom" have to do with that? Do you want someone to write this for you or do you want to learn why ...
by tom.slick
Mon Aug 01, 2016 1:13 am
Forum: Python
Topic: WiringPi Python
Replies: 11
Views: 1763

Re: WiringPi Python

by tom.slick
Sun Jul 31, 2016 4:00 am
Forum: Python
Topic: Slither Game
Replies: 4
Views: 946

Re: Slither Game

Rethink your math and your order of operations round(random.randrange(0, display_height - block_size / 10.0) * 10) round(random.randrange(0, display_width - block_size / 10.0) * 10) display_width = 800 display_height = 600 block_size = 10 display_height - block_size / 10.0 600 - 10 / 10.0 600 - 1.0 ...
by tom.slick
Wed Jul 27, 2016 4:26 am
Forum: Python
Topic: import wiringpi/smbus problem
Replies: 3
Views: 923

Re: import wiringpi/smbus problem

You never state how you installed anything.

For wiringpi do both of these commands, first the c libraries then the python module
sudo apt-get install wiringpi
sudo pip3 install wiringpi

for smbus
sudo apt-get install python3-smbus
by tom.slick
Wed Jul 27, 2016 4:12 am
Forum: Python
Topic: Can not send time in email
Replies: 2
Views: 612

Re: Can not send time in email

import smtplib import time to = "[email protected].net" gmail_user = "[email protected].com" gmail_pwd = "xxxxxxxx" def send_mail(msg, subject="Time sent"): header = "To:" + to + "\n" + "From:" + gmail_user + "\n" + "Subject:" + subject + "\n" msg = header + "\n " + msg + "\n\n" smtpserver = smtplib.S...
by tom.slick
Wed Jul 27, 2016 3:56 am
Forum: Python
Topic: Turtle
Replies: 4
Views: 1059

Re: Turtle

Rename your file. Call it something other then turtle.py
by tom.slick
Sun Jul 24, 2016 11:52 pm
Forum: Python
Topic: Newbie Pushutton, lights and loops
Replies: 6
Views: 908

Re: Newbie Pushutton, lights and loops

sd1976 wrote:Awesome! Just what I needed. The first one seemed to be perfect. The 2nd one seemed to work but was a bit quirkier as I had to press the button multiple times on a few of the cycles. Might just have been me :)! Thank you so, so much!
make it time.sleep(.005)
by tom.slick
Sun Jul 24, 2016 9:44 pm
Forum: Python
Topic: Newbie Pushutton, lights and loops
Replies: 6
Views: 908

Re: Newbie Pushutton, lights and loops

The reason this does not work at the top of the loop do_print is set to False when a button is pressed do_print is set to True if a button was pressed then all of these elif statement are ignored and we go back to the top of the loop and do_print is set to False when you get inside an elif do_print ...
by tom.slick
Thu Jul 14, 2016 5:33 pm
Forum: Python
Topic: Multiline commands in Python shell.
Replies: 5
Views: 1909

Re: Multiline commands in Python shell.

I have been doing all of my work in IDLE because the books I use with the kids uses IDLE. My quandary came about because I was learning about "\" and the ". . . ". I was able to reproduce the code with "\" but was not able to generate the ". . .". I did not think it would be important in what I am ...
by tom.slick
Thu Jul 14, 2016 4:18 am
Forum: Python
Topic: Problem with print('Hello', name) - Brand new to python
Replies: 4
Views: 902

Re: Problem with print('Hello', name) - Brand new to python

Sorry, have rewritten this multiple times as I'm getting myself more confused trying to write this and understand the issue. I've read a lot online and tried numerous tutorials. I have spent hours trying to trouble shoot reading various sources to understand the issue but just can't get it nailed d...
by tom.slick
Sat Jul 09, 2016 6:08 am
Forum: Python
Topic: Syntax error for except
Replies: 5
Views: 1063

Re: Syntax error for except

Like the others have said Use code tags Post the entire trackback and don't copy and paste if you don't need to wget https://raw.githubusercontent.com/sunfounder/Sunfounder_SensorKit_Python_code_for_RaspberryPi/master/01_hall_1.py The script works. You most likely introduced some bad encoding with t...
by tom.slick
Sat Jul 02, 2016 5:10 am
Forum: Python
Topic: RPi.GPIO Wiegand capture speed?
Replies: 68
Views: 30049

Re: RPi.GPIO Wiegand capture speed?

Using same card (9817354), my first read is 26 bits then all reads after that are 27 bits... if result == 2923229214: # the number of my test badge bits = '0' print rfid_read else: bits = '0' timeout = t print "Bad Read" print rfid_read No, your read is still 26 bits, but when you clear the value o...
by tom.slick
Thu Jun 30, 2016 11:36 pm
Forum: Python
Topic: python - read csv into array
Replies: 7
Views: 3522

Re: python - read csv into array

Works in python2 or python3 #!/usr/bin/env python import csv from collections import OrderedDict as dict # change the dict type to ordered # it will make this a little easier to work with # when printing the results or writing it to a file csv.dict = dict # lets not worry about whitespace after the ...
by tom.slick
Wed Jun 29, 2016 8:34 am
Forum: Python
Topic: Yowsup
Replies: 9
Views: 1680

Re: Yowsup

not is a disccucion of the new version of python, ¬¬ I need help with the code helpme!!!! https://drive.google.com/file/d/0B4T5GjWMH73WYU9nWDRBbEpIbWs/view?usp=sharing Dismissing correct advice because you don't understand it and making demands will get you no where. Do some research of your own. T...
by tom.slick
Fri Jun 24, 2016 6:34 am
Forum: Python
Topic: Tkinter GUI Freezes - Tips on threading/unblocking GUI?
Replies: 28
Views: 11725

Re: Tkinter GUI Freezes - Tips on threading/unblocking GUI?

Here is the updated code i was running: #!/usr/bin/env python import atexit import sys import signal import threading import time import RPi.GPIO as GPIO import Adafruit_DHT import random try: # python 2 from Tkinter import * import tkFont except ImportError: # python 3 from tkinter import * import...
by tom.slick
Thu Jun 23, 2016 7:46 am
Forum: Python
Topic: Help with code
Replies: 8
Views: 1083

Re: Help with code

Hi, Sorry if this is not the wright place to post this, but could someone help me. I am a first time coder and I am working with someone to build a timer for a gravity race track and I can not get my code to work. Please help. Two deal breakers in your code The first one First you set an input pin ...
by tom.slick
Wed Jun 22, 2016 10:17 pm
Forum: Python
Topic: Tkinter GUI Freezes - Tips on threading/unblocking GUI?
Replies: 28
Views: 11725

Re: Tkinter GUI Freezes - Tips on threading/unblocking GUI?

Exception in thread Thread-1: Traceback (most recent call last); File "/usr/lib/python3.4/threading.py", line 920 in _bootstrap_inner self.run() "GTC0.9", line 41, in run self.temperature = str(9.0/5.0 * temperature +32) TypeError: unsupported operand type(s) for *: 'float' and 'NoneType' That one ...
by tom.slick
Wed Jun 22, 2016 12:01 am
Forum: Python
Topic: Triggering system!
Replies: 15
Views: 3946

Re: Triggering system!

https://learn.adafruit.com/ir-breakbeam-sensors taken from the adafruit tutorial, ported to python Both red wires go to 3.3v or 5V Both black wires go to ground The white wire goes to a gpio pin of your choice on the RPI import RPi.GPIO as GPIO import time pin = 4 # pick whatever pin you hooked the ...
by tom.slick
Tue Jun 21, 2016 11:21 pm
Forum: Python
Topic: Tkinter GUI Freezes - Tips on threading/unblocking GUI?
Replies: 28
Views: 11725

Re: Tkinter GUI Freezes - Tips on threading/unblocking GUI?

I verified the times i have set in original versions of my code match what you call out. But for some reason they don't operate the same way mine did. For example. EX1 to EX2 is a .3 second pulse. EX1 to EX 3 is a .5 second pulse. That makes the jump between EX3 back to EX2 .2, which is what is cal...
by tom.slick
Tue Jun 21, 2016 12:06 am
Forum: Python
Topic: Tkinter GUI Freezes - Tips on threading/unblocking GUI?
Replies: 28
Views: 11725

Re: Tkinter GUI Freezes - Tips on threading/unblocking GUI?

Must be over thinking this part but where do i define this function? And do i first have to establish the water level variable as global somewhere? I havent tried this yet but here's what im thinking so far: def check_water_level(self): #do i need the self? most other functions you define in the sc...
by tom.slick
Mon Jun 20, 2016 6:27 am
Forum: Python
Topic: Need help with controlling relay using multiple DS18B20's
Replies: 4
Views: 1363

Re: Need help with controlling relay using multiple DS18B20'

look at the examples from w1thermsensor import W1ThermSensor for sensor in W1ThermSensor.get_available_sensors([W1ThermSensor.THERM_SENSOR_DS18B20]): print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature())) So maybe you would do something like sensors = W1ThermSensor.get_avail...

Go to advanced search