Go to advanced search

by Sbs-ula
Thu Oct 04, 2018 8:57 am
Forum: Python
Topic: Ajax GPIO
Replies: 2
Views: 834

Ajax GPIO

Hello, I don’t know how Ajax work with python. So if the mousedown on a text, then toggle one GPIO on and mouseup toggle GPIO off. My code by now: from bottle import route, request, run, get import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) GPIO.output(19, GPIO.LOW)...
by Sbs-ula
Sun Nov 26, 2017 5:10 pm
Forum: Python
Topic: Database for NFC reader
Replies: 2
Views: 1148

Database for NFC reader

Hello everyone I have two raspberrys on different locations with NFC readers (RC522). They have the basic python program to open the door with one relay: #!/usr/bin/env python # -*- coding: utf8 -*- import RPi.GPIO as GPIO import MFRC522 import signal import time GPIO.setmode(GPIO.BOARD) GPIO.setwar...
by Sbs-ula
Sun Nov 26, 2017 4:55 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

I'm back from my holiday and I will write this week new knowledgements from my bug. I experiment something else this week.
by Sbs-ula
Thu Nov 16, 2017 5:00 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

I mesured and the Pi did change the GPIO from HIGH to LOW. So he did put out 3V to the relay. And I changed the relay Card to another, but the fail was back. So is the GPIO pin from the Pi broken? I have on the same Pi one NFC reader (RC522) python program. It open the door with relay, if it is the ...
by Sbs-ula
Tue Nov 14, 2017 7:27 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

I can already say that the fail was on 16:31:44 and the program went up to 16:57:23.

So there are 3 times more trys to turn on the lights after the bug.

And I can also say, that my relay don't switch. I saw it on the led from the last try on 16:57:23. She isn't turn on and off.
by Sbs-ula
Tue Nov 14, 2017 5:21 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

After one fail, it fails every time
And after a restart of the program works it correct.
by Sbs-ula
Tue Nov 14, 2017 4:34 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

I have the code already with time stamp, so here is the complete log file: waiting check light level its not dark dont turn light on Tue Nov 14 8:45:42 2017 count down started waiting check light level its not dark dont turn light on Tue Nov 14 10:01:50 2017 count down started waiting check light le...
by Sbs-ula
Tue Nov 14, 2017 4:08 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

I try it out, and I think the rc.local don't save the log at the reboot. So I started it manually and then have I a log file with correct content. I started it 9 hours ago. Here is the content: waiting check light level its not dark dont turn light on count down started waiting check light level its...
by Sbs-ula
Mon Nov 13, 2017 9:46 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

I put it back in the rc.local with the exactly the same command.

He make the light.log file new, but in this file is nothing after the reboot. Nothing "waiting" or anything else.
by Sbs-ula
Mon Nov 13, 2017 9:27 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Yes, with the command on the terminal was ist possible. They don't print waiting, but in the log file there was print waiting.

Must I turn it on manually and wait for the bug, or what do you think?

Edit:
I removed the log file and start up with sudo
by Sbs-ula
Mon Nov 13, 2017 9:14 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Yes, if I start with the command:

Code: Select all

python /home/pi/light/backup/light.py
Then is the output:

Code: Select all

waiting
So that's right.

And if I type with the command nano, then it is the right file with the program code from the top of this thread.
by Sbs-ula
Mon Nov 13, 2017 9:00 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Here is the full copy of the rc.local: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # ...
by Sbs-ula
Mon Nov 13, 2017 8:30 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Yes I also don't understand it, but here is the output from the command python: Python 2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> It is the same like you already said. But whats wrong? Edit: So here is my fu...
by Sbs-ula
Mon Nov 13, 2017 5:43 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

So it has happened again with the bug. This is the content of the log file: Python 2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> And nothing more. I switch off the autostart from the crontab and the pi was on f...
by Sbs-ula
Sun Nov 12, 2017 8:15 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

So I understand it.
I change the line in the rc.local and the reboot at 12pm make the log file.

I will you write with the result of the log file.
by Sbs-ula
Sun Nov 12, 2017 7:36 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

the line in the rc.local is:

Code: Select all

python /home/pi/light/backup/light.py &
It works always with the bug, that he don't switch the GPIOs after hours. So I don't change anything, so not in the program or in the rc.local
by Sbs-ula
Sun Nov 12, 2017 7:28 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

So with "existing" is in the .log file:

Code: Select all

bash: existing: command not found 
and without "existing":

Code: Select all

python: can't open file 'call': [Errno 2] No such file or directory
by Sbs-ula
Sun Nov 12, 2017 7:13 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Okay, so I try it out, but the console say: bash: syntax error unexpected word `2 ' And the path must be the same path as the python script, only with log at the end? EDIT: So without the first ">" makes me an log file with the content: python: can't open file 'call': [Errno 2] No such file or direc...
by Sbs-ula
Sun Nov 12, 2017 4:52 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Now the script works in the right order. But I reboot my pi every day on 12 pm with a crontab job, it works so far. The light control script starts up with the reboot by the rc.local. My problem now is, that the pi after round about 10 or 11 hours don't turn on the lights. I tested manually without ...
by Sbs-ula
Sat Nov 04, 2017 11:23 am
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Ok thanks for the idea, but it isn't wrong with the 0.5 seconds, because my control gear from the lights is using only tast pulses for turn on or off the light.
by Sbs-ula
Sat Nov 04, 2017 7:05 am
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Re: Light sensor BH1750

Yes with this arrgument work analyse for the example "mode 1" and "mode 2": if (int(readLight())) > 100: So now I want the integration from the light sensor in the PIR script. But where put it in the code to turn on or not the light? import RPi.GPIO as GPIO import time import smbus GPIO.setmode(GPIO...
by Sbs-ula
Fri Nov 03, 2017 4:58 pm
Forum: Python
Topic: Light sensor BH1750
Replies: 39
Views: 5977

Light sensor BH1750

Hello, for my project I want a python code to control the light. So if a input from my PIR sensor turn the light on, but check the light level and then turn the light on or not. I have a basic script for the PIR sensor light control without any light sensor addon: import RPi.GPIO as GPIO import time...
by Sbs-ula
Wed Oct 25, 2017 5:18 am
Forum: Python
Topic: light control with off delay
Replies: 3
Views: 1259

Re: light control with off delay

With this codes work it fine.
Thank you very much!
by Sbs-ula
Mon Oct 23, 2017 5:56 pm
Forum: Python
Topic: light control with off delay
Replies: 3
Views: 1259

light control with off delay

Hello everyone, so my next project is a light control with PIR sensors. I have one input to my raspberry and one output to the light relay. The PIR sensor give me one 5 sec signal to my input, if he is detect any motion. Now I want a python handling to turn the light on. But not only light "on" - if...

Go to advanced search