Go to advanced search

by scotty101
Mon May 21, 2018 12:54 pm
Forum: General discussion
Topic: how to transer image from one pi to another pi
Replies: 1
Views: 72

Re: how to transer image from one pi to another pi

Perhaps if you share the code you used to unpack and send the data, someone might be able to help you to write the code to recieve and re-pack the data.

FYI there are many existing protocols for transmitting files via serial links. XMODEM or kermit for example
by scotty101
Mon May 21, 2018 11:25 am
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

Just add a new line after you've written the results.

Code: Select all

    with open("/home/pi/data_log.csv", "a") as file:
            if os.stat("/home/pi/data_log.csv").st_size == 0:
                file.write("CH0,CH1,CH2,CH3,CH4,CH5,CH6,CH7\n")
            file.write(results)
            file.write('\n')
by scotty101
Fri May 18, 2018 11:48 am
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

You need to take responsibility for your own learning. Copy and Pasting other people's code will only get you so far. Python is easy but you won't find it easy if you try to jump in right at the deep end without first understanding the basics. Do you actually understand the code that you've been giv...
by scotty101
Fri May 18, 2018 10:44 am
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

It won't... unless you happen to want a file that just says values[i] values[i] values[i] values[i] values[i] values[i] values[i] values[i] .... 1. Read the psuedo code I gave you. 2. Realise that file.write('values[ ­i]') will just output the text values[ i] not the i-th value of the array called v...
by scotty101
Fri May 18, 2018 10:33 am
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

So you probably need to change your code. At the moment your while loop where you read the GPIO pin won't do what you expect. Here is some psuedo code for you While Loop - Infinite Loop for each of the 8 ADC channels Read ADC channel i and store it to values[i] End loop print out to screen all 8 ADC...
by scotty101
Fri May 18, 2018 10:23 am
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

Ghwana wrote:
Fri May 18, 2018 9:58 am
sent to csv through switch,
What does "through switch" mean?
by scotty101
Fri May 18, 2018 10:15 am
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

You have a loop to read from the ADC channels but you haven't included in that loop the code to write each reading to the file. You can either combine the reading a writing to a single loop for i in range(8): value[i] = readadc(i) #write value[i] to file Or have two seperate loops, one to read ADC a...
by scotty101
Fri May 18, 2018 9:38 am
Forum: Python
Topic: Unable to write to a .txt file when using GPS
Replies: 2
Views: 67

Re: Unable to write to a .txt file when using GPS

As already mentioned you aren't actually writing the data from the serial port to the file. I've changed your code to add f.write(x) which will write the line from the serial port to the file. I've also added a "context manager" to deal with opening and closing the file. Untested code, but it should...
by scotty101
Thu May 17, 2018 4:08 pm
Forum: Beginners
Topic: object detection
Replies: 3
Views: 102

Re: object detection

What is your question?
Which parts of your project do you need help with?

Is this object detection with a camera?

FYI: object detection/recognition is not a simple beginners project.
by scotty101
Thu May 17, 2018 3:54 pm
Forum: Advanced users
Topic: Trouble getting modbus over RS485 connecting to GPIO
Replies: 5
Views: 124

Re: Trouble getting modbus over RS485 connecting to GPIO

I'm a little surprised there isn't a working rs485 driver out there somewhere. It shouldn't be surprising. RS485 is an electrical standard about the voltages, wires etc not a communications standard that tells you how to deal with full/half duplex. RS-485 is not a protocol; it's simply an electrica...
by scotty101
Thu May 17, 2018 3:17 pm
Forum: Troubleshooting
Topic: MCP 3008 Chip sending data to CSV file via switch
Replies: 21
Views: 308

Re: MCP 3008 Chip sending data to CSV file via switch

Which line is throwing the error? There are a few candidates. The error suggests that you are trying to add an integer to a string. If you want to append a number to a string then you need to cast the number to a string Or if you want to add two values together then you need to cast the string to a ...
by scotty101
Wed May 16, 2018 3:43 pm
Forum: Beginners
Topic: Pi 3 - buy kit or buy separate? + Do I need heat sink?
Replies: 6
Views: 200

Re: Pi 3 - buy kit or buy separate? + Do I need heat sink?

Unless you are using your Pi in a very hot environment and running complex calculations on it you do not need a heat sink. It is designed to "throttleback" if it gets too hot. The kit is ok. Will work out a little cheaper for you but don't rely on the "pre-installed OS" working. Keep the SD card and...
by scotty101
Wed May 16, 2018 10:46 am
Forum: Beginners
Topic: hdmi cable for first start
Replies: 2
Views: 82

Re: hdmi cable for first start

marinho2018 wrote:
Wed May 16, 2018 2:08 am
hey everyone,
What the best HDMI cable to buy for RP3? :?:
You don't need anything special for a Pi3, just a regular HDMI cable will do.
by scotty101
Wed May 16, 2018 9:15 am
Forum: Other projects
Topic: A portable maker space for home
Replies: 5
Views: 179

Re: A portable maker space for home

Great concept and I totally get your use case, I was about to get a hobby desk until my fiance moved in and we needed more storage!
Could the side panels of the unit be folded down to give a larger workspace? Looks like the front panel fold down.
by scotty101
Wed May 16, 2018 8:42 am
Forum: General discussion
Topic: Capacitive Sensor Range
Replies: 3
Views: 139

Re: Capacitive Sensor Range

Sound like you need to do some science and set up an experiment to test this.
Unlikely that someone on here has exactly the same sensors.
by scotty101
Tue May 15, 2018 3:17 pm
Forum: Python
Topic: Where are python libraries installed to?
Replies: 4
Views: 191

Re: Where are python libraries installed to?

A recent XKCD explains the python environment 'spaghetti' quite well

https://m.xkcd.com/1987/
by scotty101
Mon May 14, 2018 8:07 pm
Forum: Python
Topic: Use 2 devices withe the i2c ports
Replies: 5
Views: 132

Re: Use 2 devices withe the i2c ports

Provided that the I2C devices have different addresses, multiple devices can be connected to the same I2C port.
by scotty101
Mon May 14, 2018 11:29 am
Forum: Python
Topic: Can I rotate "sprites" in Tkinter - PYTHON 2?
Replies: 4
Views: 172

Re: Can I rotate "sprites" in Tkinter - PYTHON 2?

You'd probably find this easier in PyGame.

I do have an example from years ago of rotating an aircraft sprite to make an air traffic control game. Let me know if you'd find it useful
by scotty101
Mon May 14, 2018 11:18 am
Forum: Beginners
Topic: Help.. PI 3 to control actuators from an IMU?
Replies: 2
Views: 72

Re: Help.. PI 3 to control actuators from an IMU?

Someone else has done this exact project but I can't for the life of me find it!

EDIT: Found it! viewtopic.php?t=205653
I'm sure there was a more indepth article though.
by scotty101
Mon May 14, 2018 11:15 am
Forum: Beginners
Topic: write file.txt with turn on and turn off hours
Replies: 3
Views: 114

Re: write file.txt with turn on and turn off hours

You can't have the code write to a file when it turns off because there is no way to detect that the battery is about to die. You could however write to a file the current time every 5 minutes or so. You would be able to do this using cron to schedule the task and then a simple bash or python script...
by scotty101
Mon May 14, 2018 11:12 am
Forum: Python
Topic: Is it possible to use an interrupt to detect a key press
Replies: 15
Views: 361

Re: Is it possible to use an interrupt to detect a key press

It just occurred to me. If I produce a tkinter window with some buttons to press (so virtual keys, rather than the real thing), and then set the program to increment the relevant tilt or pan axis, maybe that would be an easier way of doing it. With tkinter you can bind a callback to a specific butt...
by scotty101
Sat May 12, 2018 4:35 pm
Forum: Python
Topic: Python Bluetooth Display
Replies: 3
Views: 122

Re: Python Bluetooth Display

What is your question? Does you code not work? Do you get error messages?
Can you share some more information about what you are trying to do? What components you are using?

More information you give, the more likely it is someone will be able to help.
by scotty101
Fri May 11, 2018 9:53 pm
Forum: General discussion
Topic: Cryptography
Replies: 13
Views: 520

Re: Cryptography

Depends what your experience is and whether this is just a learning experience or not. If you are a total beginner, start with figuring out how to create a simple program that does a caeser cipher. This is very simple to do in Python. If you want something that is actually secure, use a open source ...
by scotty101
Fri May 11, 2018 11:28 am
Forum: Python
Topic: Using Python to look for a difference in response to HTML request from a website's API
Replies: 14
Views: 339

Re: Using Python to look for a difference in response to HTML request from a website's API

I would always recommend using Requests rather than the built in python urllib's.
Much more user friendly and well tested too.
by scotty101
Fri May 11, 2018 9:00 am
Forum: General discussion
Topic: Model train project help
Replies: 9
Views: 398

Re: Model train project help

Options that I would consider are; PyGame https://www.pygame.org/news A python library for creating multimedia applications. It has functions to draw lines, or more complex widgets on screen. Tkinter - Pre-installed with most python distributions. A slightly old fashioned but powerful GUI framework....

Go to advanced search