Go to advanced search

by buja
Fri Jan 25, 2019 8:52 pm
Forum: C/C++
Topic: current date + time feat. also milliseconds?
Replies: 16
Views: 523

Re: current date + time feat. also milliseconds?

deleted
by buja
Fri Jan 25, 2019 6:53 pm
Forum: C/C++
Topic: current date + time feat. also milliseconds?
Replies: 16
Views: 523

Re: current date + time feat. also milliseconds?

You should have a look at the function gettimeofday() and the struct timeval.

On the command line:

Code: Select all

man gettimeofday
by buja
Thu Dec 20, 2018 1:24 pm
Forum: General discussion
Topic: Wires and peripherals, ugly or tidy?
Replies: 19
Views: 963

Re: Wires and peripherals, ugly or tidy?

If a cluttered desk is a sign of a cluttered mind, of what, then, is an empty desk a sign?
(this is supposed to be a quote from Albert Einstein)
by buja
Fri Nov 30, 2018 4:32 am
Forum: Raspbian
Topic: Error on Foundation Website NGINX
Replies: 1
Views: 287

Re: Error on Foundation Website NGINX

Milliways wrote:
Fri Nov 30, 2018 3:20 am
I was just looking at https://www.raspberrypi.org/documentati ... r/nginx.md and noticed this still has references to PHP5

This should be updated as Stretch installs PHP5
If the page refers to PHP5 and Raspbian Stretch installs PHP5, then what is the problem?
by buja
Tue Nov 27, 2018 10:04 pm
Forum: General discussion
Topic: Print buffer
Replies: 6
Views: 241

Re: Print buffer

That would be:

Code: Select all

fflush(stdout);
right after the printf-statement.
by buja
Mon Nov 26, 2018 10:43 pm
Forum: C/C++
Topic: C vs Python which has more GPIO support?
Replies: 8
Views: 1584

Re: C vs Python which has more GPIO support?

What happened here? This question got moved from the end of a thread dating back to 2012 to this new thread. But the responses there did not move with it. ... So my incredibly valuable contribution is lost? :o For the record, it should be the second post, as a reply to zeilotech's question. So all ...
by buja
Sun Nov 25, 2018 10:20 pm
Forum: C/C++
Topic: C vs Python for GPIO
Replies: 27
Views: 19057

Re: C vs Python for GPIO

Python has more support than C. Almost every piece of hardware for the Pi comes with a Python library to support it. Supplier support for C is sometimes available, supplier support for other languages seems to be non-existent. If you like to write your own C driver software there are the GPIO librar...
by buja
Fri Nov 23, 2018 7:30 pm
Forum: Beginners
Topic: returning values from functions
Replies: 6
Views: 283

Re: returning values from functions

There are two different variables with the same name "result". The one that is initialized to 0 in line 2 is a global variable. It is never updated, so that's why it prints as 0. The one used inside the function "maths" is interpreted a a new, local variable. It's value is returned as the value of t...
by buja
Fri Nov 23, 2018 7:13 pm
Forum: Beginners
Topic: returning values from functions
Replies: 6
Views: 283

Re: returning values from functions

Try this:

Code: Select all

result = maths(100)
print result
by buja
Fri Nov 23, 2018 6:51 pm
Forum: Troubleshooting
Topic: Impossible to uninstall Firefox
Replies: 3
Views: 628

Re: Impossible to uninstall Firefox

How did you install Firefox?
How did you uninstall Firefox?
Which commands did you use?
Which messages did you get?
Why do you think Firefox is still installed when the system tells you it is not installed anymore?
by buja
Fri Nov 23, 2018 7:00 am
Forum: Teaching and learning resources
Topic: Anyone using LaTeX
Replies: 11
Views: 3078

Re: Anyone using LaTeX

YP: Young People?
by buja
Fri Nov 23, 2018 6:52 am
Forum: Beginners
Topic: Oil boiler
Replies: 13
Views: 621

Re: Oil boiler

Did I mention clamp? I am not sure what you mean here. Looking at it some more I agree with other posters that making modifications to the boiler installation has some safety issues. Which makes the idea of some light sensor looking at the flame inspection window a very attractive one. Prices for ho...
by buja
Thu Nov 22, 2018 11:08 pm
Forum: Beginners
Topic: Oil boiler
Replies: 13
Views: 621

Re: Oil boiler

I think a Pi is perfect for this kind of thing, but there is some engineering to do. As mentioned above, tampering with 240 VAC brings serious safety issues, but even 24 VDC and 12 VDC are not without issues. And a Pi can take only 3.3 Volt DC for input, anything higher than that will fry the SOC. B...
by buja
Sun Nov 04, 2018 4:38 pm
Forum: Beginners
Topic: Trying to save edited file
Replies: 6
Views: 203

Re: Trying to save edited file

The file "/etc/default/keyboard" is owned by root, so you have to open it with root rights to save any changes:

Code: Select all

sudo nano /etc/default/keyboard
by buja
Tue Oct 30, 2018 4:56 am
Forum: C/C++
Topic: What does mtkime with tm_isdst = -1 do during DST transition?
Replies: 1
Views: 1420

Re: What does mtkime with tm_isdst = -1 do during DST transition?

No real answer I am afraid. My first thought was that tm_isdt should never be negative, but K&R says this: tm_isdt is positive if Daylight Saving Time is in effect, zero if not, and negative if the information is not available. If behavior is undefined I think the only options is to test what the be...
by buja
Fri Oct 26, 2018 8:42 am
Forum: Troubleshooting
Topic: Installing PHP using Raspbian & Nginx
Replies: 8
Views: 597

Re: Installing PHP using Raspbian & Nginx

So how do I go about installing apache? I thought nginx was used to save resources since the card is 32gb. Do I need the php-apc thing mentioned in the video? https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress This looks like it's only for WordPress websites. I don't want t...
by buja
Wed Oct 24, 2018 9:11 am
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1549

Re: BMP280, testers needed

That's it, thanks!
by buja
Wed Oct 24, 2018 8:49 am
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1549

Re: BMP280, testers needed

Why not use the kernel driver? Add dtoverlay=i2c-sensor,bmp280 to /boot/config.txt Your BMP280 will then appear as /sys/bus/iio/devices/iio:device0 with various "virtual" files in there to give you the readings from the sensor. I have my BMP280 sensor working, I checked with a Python script for the...
by buja
Sun Oct 21, 2018 4:33 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1549

Re: BMP280, testers needed

Thanks! That "BMP280 returned 0 instead of 88. Expect problems." tells me that my driver don't see bmp280. What gpio did you use? It has to be somewhere "free", so GPIO can simulate SPI. I2C doesn't work yet. The degree sign issue is strange. What error did you get? python measure.py~ File "measure...
by buja
Sun Oct 21, 2018 4:20 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1549

Re: BMP280, testers needed

Could it be that Dougie's way does not work because in the Python setup the sensor is connected via SPI, and not I2C?
by buja
Sun Oct 21, 2018 4:16 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1549

Re: BMP280, testers needed

Useful info from Dougie, but I tried the Python program anyway. First issue: get rid of the degree sign, my Pi did not like it. Second issue: it's not going well, see below. python measure.py BMP280 returned 0 instead of 88. Expect problems. /home/wwx/bmp280-master/bmp280.py:290: RuntimeWarning: ove...
by buja
Sat Oct 20, 2018 5:43 am
Forum: Python
Topic: Must be a simple answer to this keyboard input problem
Replies: 3
Views: 313

Re: Must be a simple answer to this keyboard input problem

This runs okay in Python3, but gives the error in Python2.

For Python2 this should do it:

Code: Select all

print fn,"is user", usr
by buja
Tue Oct 16, 2018 3:38 pm
Forum: C/C++
Topic: I am missing some fundamental understanding of C?
Replies: 13
Views: 1764

Re: I am missing some fundamental understanding of C?

What does this mean?

Code: Select all

lfb.putpixel(x+test.xoffset,y+test.yoffset,test.data[x][y]);
putpixel looks like a function to me, with 3 arguments, but what does lfd.putpixel() mean? (I don't understand the dot notation here)
by buja
Fri Oct 12, 2018 4:12 pm
Forum: General discussion
Topic: How can you prove raspberry pi 3B+ is suitable for industrial and stamping factory environment?
Replies: 11
Views: 605

Re: How can you prove raspberry pi 3B+ is suitable for industrial and stamping factory environment?

Saw this interesting unit while doing some browsing on Amazon for some in my Christmas shopping list...... This quite an interesting thing if you are looking for industrial applications. Amazon UK is a bit light on information on this, but this link seems to be the manufacturer: https://revolution....
by buja
Mon Oct 08, 2018 5:32 pm
Forum: Python
Topic: Run code on the top of the hour
Replies: 7
Views: 342

Re: Run code on the top of the hour

I don't understand you problem with cron, but I think with cron you would already be done with the job.

Go to advanced search