Go to advanced search

by buja
Tue Nov 27, 2018 10:04 pm
Forum: General discussion
Topic: Print buffer
Replies: 6
Views: 573

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: 2448

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: 23767

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: 644

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: 644

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: 4
Views: 2322

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: 7332

Re: Anyone using LaTeX

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

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: 1232

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: 531

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: 1840

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: 1246

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: 26
Views: 3854

Re: BMP280, testers needed

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

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: 26
Views: 3854

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: 26
Views: 3854

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: 26
Views: 3854

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: 540

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: 2731

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: 1585

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: 717

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.
by buja
Sun Oct 07, 2018 2:28 pm
Forum: Beginners
Topic: How to I2C in C ?
Replies: 4
Views: 1899

Re: How to I2C in C ?

There are several possibilities to use the I2C port in C. I used this information: http://www.raspberry-projects.com/pi/programming-in-c/i2c/using-the-i2c-interface You can also use the GPIO libraries, they have I2C functions built-in. With the GPIO libraries I mean wiringPi (pre-installed on Raspbi...
by buja
Mon Oct 01, 2018 6:23 pm
Forum: Other programming languages
Topic: A compilable basic that uses line numbers for Pi?
Replies: 53
Views: 18214

Re: A compilable basic that uses line numbers for Pi?

Those silly commands come from a time when it made perfect sense to be as short as possible because people used teletype terminals and slow serial connections (75 bits per second or so). Those days are gone, but we still have to deal with this legacy. And frankly, the handful of commands Heater list...
by buja
Thu Sep 27, 2018 7:05 pm
Forum: C/C++
Topic: can not use wiringPi with code blocks
Replies: 3
Views: 1654

Re: can not use wiringPi with code blocks

In the terminal commands you switch the LED on and off, but in your program you only switch it on.
So all you need to do is add an instruction to switch the LED off, just like you do on the command line.

Go to advanced search