Go to advanced search

by timothyy
Thu Oct 03, 2019 1:08 pm
Forum: Python
Topic: GUI saving files problem
Replies: 3
Views: 250

GUI saving files problem

Hi, I am using tkinter to make a saving button which can store all the data from various mass flow controllers (MFC). The address of the ADC boards are adc1 = ADCPi(0x68,0x69,12) & adc2 = ADCPi(0x6A,0x6B,12). I got some problems when i saving the file. The text file shows this rather than the channe...
by timothyy
Fri Sep 27, 2019 3:08 pm
Forum: Advanced users
Topic: Headless RasPi running Python script
Replies: 15
Views: 457

Re: Headless RasPi running Python script

i typed this at the end of the command

Code: Select all

@reboot sudo python /home/pi/Desktop/Testing/Testing.py
by timothyy
Fri Sep 27, 2019 2:56 pm
Forum: Advanced users
Topic: Headless RasPi running Python script
Replies: 15
Views: 457

Re: Headless RasPi running Python script

Code: Select all

def writetotxtfile(texttowrite,filename):
    file = open(str(filename), 'a')
    file.write(str(datetime.datetime.now()) + " " + str(texttowrite) + '\n')
    file.close()
I call the file on boot is /home/pi/Desktop/Testing/Text1.txt
by timothyy
Fri Sep 27, 2019 2:45 pm
Forum: Advanced users
Topic: Headless RasPi running Python script
Replies: 15
Views: 457

Re: Headless RasPi running Python script

/home/pi/Desktop/Testing/text1.txt
by timothyy
Fri Sep 27, 2019 1:45 pm
Forum: Advanced users
Topic: Headless RasPi running Python script
Replies: 15
Views: 457

Re: Headless RasPi running Python script

Hi, i also got a writetotxtfile("something","text1.txt"), everytime i reboot it the data doesn't write to the textfile. Any help?
by timothyy
Thu Sep 26, 2019 9:28 am
Forum: Python
Topic: LED-button with detected pressed time
Replies: 10
Views: 395

Re: LED-button with detected pressed time

Hi,

In additional, i found the code maybe have some time delays between the pressed button and the LED blinking, any chance i can increase he process time?
by timothyy
Tue Sep 24, 2019 8:31 am
Forum: Python
Topic: LED-button with detected pressed time
Replies: 10
Views: 395

Re: LED-button with detected pressed time

Thank you so much. It's working!!
by timothyy
Tue Sep 24, 2019 8:15 am
Forum: Python
Topic: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
Replies: 1
Views: 164

RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.

Hi, When i running this programme, the editor shows "RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.", and the LEDs aren't blinking at all. Any thought? from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) button1...
by timothyy
Tue Sep 24, 2019 8:12 am
Forum: Python
Topic: LED/button: pressed how many time and how long
Replies: 1
Views: 104

LED/button: pressed how many time and how long

Hi, I am doing a project which has two functions, 1) how many times the button be pressed 2) How long the button be pressed, the first part works perfectly, however, the second part at def myInterrupt1(channel): and def myInterrupt2(channel):. It doesn't save any text to the file at all. Any thought...
by timothyy
Tue Sep 24, 2019 7:44 am
Forum: Python
Topic: LED-button with detected pressed time
Replies: 10
Views: 395

Re: LED-button with detected pressed time

I didn't print anything,even i added the line print("button time")after
by timothyy
Tue Sep 24, 2019 5:34 am
Forum: Python
Topic: LED-button with detected pressed time
Replies: 10
Views: 395

Re: LED-button with detected pressed time

Corrected the code. But it seems only "button1" and "button2"save to the file, no "long pressed", "medium pressed" and "short pressed" from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) button1=16 button2=12 LED1=22 LED2=18 GPIO.setup(button1,GPIO.IN,pull_up_down=GPIO.PUD_UP) GP...
by timothyy
Mon Sep 23, 2019 5:05 pm
Forum: Advanced users
Topic: Headless RasPi running Python script
Replies: 15
Views: 457

Headless RasPi running Python script

Hi,

I have a headless Raspberry 3 which i am planning to put in a exhibition for 2 months. So, how to tell the headless Raspberry Pi to run a python script that i wrote at the beginning and keep it running without stopping for 2 months (yes, no monitor)?


Timothy
by timothyy
Mon Sep 23, 2019 4:30 pm
Forum: Python
Topic: LED-button with detected pressed time
Replies: 10
Views: 395

LED-button with detected pressed time

Hi, I'm trying to write a button-LED light function, meanwhile the programme can detect the time of the pressed button. It seems later of the part doesn't work at all..... from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) button1=16 button2=12 LED1=22 LED2=18 GPIO.setup(button1...
by timothyy
Mon Sep 23, 2019 12:16 pm
Forum: Advanced users
Topic: send an email using RasPi in every 15 minutes
Replies: 3
Views: 183

Re: send an email using RasPi in every 15 minutes

Is that */15 * * * * filename='filename' >/dev/null 2>&1and put after line 22?
by timothyy
Mon Sep 23, 2019 11:55 am
Forum: Advanced users
Topic: send an email using RasPi in every 15 minutes
Replies: 3
Views: 183

send an email using RasPi in every 15 minutes

Hi,

i wanted to send an email using RasPi in every 15 minutes to my email account.

This is the code i found by using smtplib:
https://github.com/samlopezf/Python-Ema ... d_email.py

So, how to modify the code and send an email with attachment in every 15 minutes?

Timothy
by timothyy
Sat Sep 21, 2019 8:09 pm
Forum: Advanced users
Topic: Online data logger for counting button presses
Replies: 2
Views: 127

Online data logger for counting button presses

Hi, I am taking part in a project which a botton is connecting to a RasPi board, the programme is written by Python. Once the button is pressed, it would show print ('button is pressed') in the command prompt. Is there any online data logger (yes, to the internet) that i can record and save this mes...
by timothyy
Mon Sep 16, 2019 11:19 am
Forum: Python
Topic: Tkinter GUI saving textfile
Replies: 4
Views: 256

Re: Tkinter GUI saving textfile

I have tried this function, but still got the same problem. Is there any way that can make the RasPi read the values? def ADClogall(): adc1 = ADCPi(0x68,0x69,12) adc2 = ADCPi(0x6A,0x6B,12) all8chn = [adc1.read_voltage(1), adc1.read_voltage(2), adc1.read_voltage(3), adc1.read_voltage(4), adc1.read_vo...
by timothyy
Thu Sep 12, 2019 11:55 am
Forum: Python
Topic: Tkinter GUI saving textfile
Replies: 4
Views: 256

Re: Tkinter GUI saving textfile

Hi, I have changed my code according to the example. def writetotxtfile(texttowrite,filename): file = open(str(filename), 'a') file.write(str(datetime.datetime.now()) + " " + str(texttowrite) + '\n') file.close() def ADClogall(): adc1 = ADCPi(0x68,0x69,12) adc2 = ADCPi(0x6A,0x6B,12) all8chn = [adc1....
by timothyy
Thu Sep 12, 2019 9:22 am
Forum: HATs and other add-ons
Topic: DHT11 add-ons to an existing ADCPi board
Replies: 1
Views: 152

DHT11 add-ons to an existing ADCPi board

Hi, I would like to link a DHT11 humidity sensor to a RasPi 3, which is connecting to Pin1 (3v3), Pin7 (GPIO4) & Pin6 (GND) on the Pi. However, i have already connected two ADCPi boards on top of my Raspberry Pi board. Is that okay to connect a DHT11 on top of my ADCPi boards and not cause any probl...
by timothyy
Fri Sep 06, 2019 10:22 am
Forum: Python
Topic: Tkinter GUI saving textfile
Replies: 4
Views: 256

Tkinter GUI saving textfile

I'm trying to make a toggle button to save a text file in Tkinter, and this is my last bit of code. I've defined toggle7, writetotxtfile and ADClogall, but saving a text file with no success. Any suggestion? def toggle7(): if var7.get() == "Saving...": writetotxtfile() ADClogall("text1.txt") var7 = ...
by timothyy
Thu Aug 08, 2019 2:49 pm
Forum: Python
Topic: How to using a value from spinbox
Replies: 3
Views: 182

Re: How to using a value from spinbox

The code i have changed into:

Code: Select all

spin1 = Spinbox(root, from_=0, to=100, width=5)
global spinsee1
spin1.place(x=150, y=30)
spinsee1=spin1.get()
spinsee1= int(x)
The DACp should be:

Code: Select all

 DACp(13,x)
by timothyy
Thu Aug 08, 2019 11:28 am
Forum: Python
Topic: How to using a value from spinbox
Replies: 3
Views: 182

How to using a value from spinbox

I wanted to use the spinbox value to control the output percentage for my on/off control. I tried DACp(13,spinsee1) and DACp(14,spinsee2), it seems that python does not accept this type of input, so it must be a number, for example: DACp(14,100). Is there a way that i can change into number and be r...

Go to advanced search