Go to advanced search

by scotty101
Mon Jul 16, 2018 2:09 pm
Forum: Automation, sensing and robotics
Topic: Detect where Pi is physically docked
Replies: 9
Views: 171

Re: Detect where Pi is physically docked

Perhaps you could describe what the Pi is connected to?

There may be a way to detect a specific serial number from one of the peripherals or a MAC address from an Ethernet adapter but impossible to tell you what unless we know what is connected at each "dock"
by scotty101
Mon Jul 16, 2018 1:07 pm
Forum: Troubleshooting
Topic: Gpio pins and pygame
Replies: 2
Views: 47

Re: Gpio pins and pygame

I'd consider using your existing GPIO code to generate "custom" pygame events that can then be processed as part of the main game loop. The answer to this question shows how to create custom events and how they are processed. https://stackoverflow.com/questions/24475718/pygame-custom-event This also...
by scotty101
Tue Jul 10, 2018 1:34 pm
Forum: Python
Topic: Get a table from a website to a CSV file
Replies: 11
Views: 236

Re: Get a table from a website to a CSV file

You appear to the two URLs in the urlopen function arguments. Which one did you want? fsa.gov.uk or bs-sct.gc.ca?
by scotty101
Mon Jul 09, 2018 3:19 pm
Forum: Python
Topic: Control GPIO with iPhone / iPad
Replies: 2
Views: 2679

Re: Control GPIO with iPhone / iPad

This topic is 6 years old. Unlikely the original poster is still around given that they only make this one post.
by scotty101
Mon Jul 09, 2018 3:14 pm
Forum: Python
Topic: Guizero - text wrapping and images from the web
Replies: 6
Views: 152

Re: Guizero - text wrapping and images from the web

You can modify that TextBox to support "word wrapping" so that words will always move a new row if there isn't space on the current line. Based on bensimmo's example above from guizero import App, TextBox, PushButton, Text def show(): output.value = textbox.value app = App() textbox = TextBox(app, m...
by scotty101
Mon Jul 09, 2018 11:08 am
Forum: Python
Topic: Guizero - text wrapping and images from the web
Replies: 6
Views: 152

Re: Guizero - text wrapping and images from the web

Guizero is based on Tkinter, and Tkinter does have a multi line equivalent of Label; Message. You can make this work with guizero doing the following from guizero import App, Text from tkinter import Message app=App(title="My gui") message=Text(app, text="A really long string that has too many chara...
by scotty101
Mon Jul 09, 2018 10:15 am
Forum: Java
Topic: Hello world server program in java
Replies: 8
Views: 245

Re: Hello world server program in java

Given up on python?
by scotty101
Fri Jul 06, 2018 9:34 am
Forum: Python
Topic: RPi3 + Python 3 = Errno 121 Remote IO error
Replies: 2
Views: 73

Re: RPi3 + Python 3 = Errno 121 Remote IO error

Can you provide the full error message provided by Python? It will make it a lot easier to figure out which line of code is causing the problem. I want a web page with 3 radio buttons (Tkinter) You can have a web page with radio buttons but this won't be with tkinter. while True: essayer: Does pytho...
by scotty101
Thu Jul 05, 2018 8:13 pm
Forum: Python
Topic: print Hello world! in python through pressing button
Replies: 13
Views: 325

Re: print Hello world! in python through pressing button

You should create a folder structure like this. MainFolder app.py templates test1.html Flask expects files to exist in a certain place. Then modify the code to return the test1.html file @app.route('/') def index(): return render_template('test1.html') When you access the page on the browser, flask ...
by scotty101
Thu Jul 05, 2018 1:21 pm
Forum: Python
Topic: print Hello world! in python through pressing button
Replies: 13
Views: 325

Re: print Hello world! in python through pressing button

Ehm... looking at your screenshot it is printing "Hello World". Where do you expect "Hello World" to be printed? In the browser or in the python console window. If you want it in the browser change @app.route('/button'): def button(): print("Hello World") return main_page to @app.route('/button'): d...
by scotty101
Thu Jul 05, 2018 12:14 pm
Forum: Python
Topic: print Hello world! in python through pressing button
Replies: 13
Views: 325

Re: print Hello world! in python through pressing button

Then I tested without error but Code is not working, When I press button it doesn't show hello World! Perhaps you can describe what does happen. Does anything happen in the python window? Does the webpage change/refresh? Since i can't try it myself at the moment, You'll need to be very descriptive ...
by scotty101
Thu Jul 05, 2018 10:34 am
Forum: Python
Topic: print Hello world! in python through pressing button
Replies: 13
Views: 325

Re: print Hello world! in python through pressing button

Untested but this seems to fit your brief. (Can't test it here) from flask import Flask main_page = """ <!DOCTYPE html> <html> <body> <h2>Button</h2> <form action="button"> <button type="submit">Press Button!</button> <form> </body> </html> """ app = Flask(__name__) @app.route('/button'): def button...
by scotty101
Mon Jul 02, 2018 2:10 pm
Forum: Python
Topic: Is it possible to make a connection to a certain Wi Fi network as a condition?
Replies: 6
Views: 179

Re: Is it possible to make a connection to a certain Wi Fi network as a condition?

b indicates that it is a python 3 "byte literal".

Try the following instead of the current if.

Code: Select all

if ssid.decode('ascii') == 'bn98':
This decodes the "bytes literal" to a standard python string.
by scotty101
Mon Jul 02, 2018 12:29 pm
Forum: Python
Topic: Is it possible to make a connection to a certain Wi Fi network as a condition?
Replies: 6
Views: 179

Re: Is it possible to make a connection to a certain Wi Fi network as a condition?

Did you put the name of your SSID in to the following line?

Code: Select all

if ssid == "MySSID"
You can of course add

Code: Select all

print(ssid)
to your code to see what wifi network is detected.
by scotty101
Mon Jul 02, 2018 9:07 am
Forum: Python
Topic: Python Arcade and Python 3.6 (or 3.7)
Replies: 1
Views: 85

Re: Python Arcade and Python 3.6 (or 3.7)

The wonderful thing about python is that multiple version can co-exist. The bad thing about python is that multiple version can co-exist. Odds are that when you installed it, it was installed in the folder that contains the python 3.5 modules and isn't visible to python 3.6. You could try re-install...
by scotty101
Sun Jul 01, 2018 12:28 am
Forum: Python
Topic: [SOLVED] Python - Sainsoft USB 4 Relay Board
Replies: 14
Views: 405

Re: Python - Sainsoft USB 4 Relay Board

1. If you are on Linux the serial port won't be called COM1. It will be something more like /dev/ttyUSB0 2. Where are you running the command from? Idle? Python interactive prompt? Or LX Terminal? You should be running it from LX Terminal. The command should probably be like python relaywrite.py /de...
by scotty101
Fri Jun 29, 2018 7:23 pm
Forum: Python
Topic: Help with Python modules
Replies: 9
Views: 245

Re: Help with Python modules

If you are using python 3 use the pip3 to install it rather than pip.
by scotty101
Fri Jun 29, 2018 7:19 pm
Forum: Python
Topic: GUI with CAN-BUS
Replies: 3
Views: 117

Re: GUI with CAN-BUS

I don't know what examples you've looked at already but I'd suggest that you use a timer event to trigger reading from the can bus periodically. Most GUI frameworks have a timer to schedule events.
by scotty101
Fri Jun 29, 2018 6:57 pm
Forum: Python
Topic: What communication protocol does Pyserial run?
Replies: 8
Views: 169

Re: What communication protocol does Pyserial run?

Perhaps if you share your code and a link to the datasheet for the controller, we can help you debug it
by scotty101
Fri Jun 29, 2018 6:49 pm
Forum: Python
Topic: Raspberry-Arduino Tkinter Gui with Matplotlib
Replies: 13
Views: 328

Re: Raspberry-Arduino Tkinter Gui with Matplotlib

the problem is only one! Yes, the numpad works correctly but it uses StringVar... so if I can't fix the string var incompatibility with matplot I can't use em at all! You just need convert the string to a float and things will be fine. You could even modify the NumpadEntry widget to return only flo...
by scotty101
Fri Jun 29, 2018 10:19 am
Forum: General discussion
Topic: Forum Shuffle
Replies: 39
Views: 1634

Re: Forum Shuffle

There has been a suggestion that with the recent "Android" revival from The MagPi. I wish that article had never been published. They didn't ask any engineers or forum people prior to publishing. This distro is nothing to do with us, needs to be PAID for, and we will not be supporting it here. If o...
by scotty101
Fri Jun 29, 2018 9:26 am
Forum: Python
Topic: What communication protocol does Pyserial run?
Replies: 8
Views: 169

Re: What communication protocol does Pyserial run?

Pyserial will output data that when connected to the correct line driver (e.g. MAX3232) will comply with the RS232 standard. Have you correctly configured the baud rate, number of data bits, parity and number of stop bits. Pyserial defaults to baudrate=9600, bytesize=EIGHTBITS, parity=PARITY_NONE, s...
by scotty101
Fri Jun 29, 2018 8:29 am
Forum: Python
Topic: Python-can
Replies: 2
Views: 56

Re: Python-can

Perhaps you are getting bad data for one cycle. You could choose to ignore the warning with an exception handler and continue in the loop hoping that the next message will be valid. For example import can import os bus = can.interface.Bus(bustype='socketcan', channel='can0', bitrate=125000) try: whi...
by scotty101
Thu Jun 28, 2018 7:14 pm
Forum: Automation, sensing and robotics
Topic: How to read out yaw/Z-Axis rotation in degress on MPU6050
Replies: 8
Views: 225

Re: How to read out yaw/Z-Axis rotation in degress on MPU6050

If you read the z axis gyro once a second and add each result to the last, you will get an approximate reading of degrees moved since the program first started.
by scotty101
Thu Jun 28, 2018 3:36 pm
Forum: Automation, sensing and robotics
Topic: How to read out yaw/Z-Axis rotation in degress on MPU6050
Replies: 8
Views: 225

Re: How to read out yaw/Z-Axis rotation in degress on MPU6050

Do you want the rate of change in the z axis or the absolute position in the z axis (like a compass bearing)? In the Z axis, you can only show the number of degrees rotated from a certain start position. Even this will gradually drift and become inaccurate. You can get pitch and roll because you are...

Go to advanced search