Go to advanced search

by buja
Sat Nov 27, 2021 9:03 pm
Forum: C/C++
Topic: tone() lib for the Pi?
Replies: 12
Views: 519

Re: tone() lib for the Pi?

Googling on "c sound library linux" does not give anything useful?
by buja
Sun Nov 21, 2021 6:35 am
Forum: C/C++
Topic: Why no warning?
Replies: 46
Views: 1907

Re: Why no warning?

The "perfectly valid C" part is exactly what is troubling me too. In my example output line C shows that indeed a float with a value within the integer range will be converted to an integer and produce a correct result. Lines E and F show that the float is truncated (=fraction part ignored...
by buja
Sat Nov 20, 2021 9:36 pm
Forum: C/C++
Topic: Why no warning?
Replies: 46
Views: 1907

Re: Why no warning?

Thanks for the replies. I was triggered by something I saw on Reddit. I thought the compiler would catch a wrong type in a function argument (b = triple_int(x)) with at least a warning, but up to GCC 10.2 in Bullseye it gives nothing on the function calls. A static analyzer (splint) did detect the p...
by buja
Sat Nov 20, 2021 7:25 pm
Forum: C/C++
Topic: Why no warning?
Replies: 46
Views: 1907

Why no warning?

I am confused. I have this little C program with a function that expects an int argument, but when I give it a float argument the compiler does not complain about it with an error, not even a warning. Why not? #include <stdio.h> #include <float.h> #include <limits.h> int triple_int(int a) { return 3...
by buja
Sun Nov 14, 2021 9:24 am
Forum: C/C++
Topic: Detect number of presses to call functions.
Replies: 10
Views: 348

Re: Detect number of presses to call functions.

Found it: #include <stdbool.h> #include <stdio.h> #include <string.h> #include <termio.h> #include <unistd.h> bool kbhit(void) { struct termios original; tcgetattr(STDIN_FILENO, &original); struct termios term; memcpy(&term, &original, sizeof(term)); term.c_lflag &= ~ICANON; tcsetatt...
by buja
Sun Nov 14, 2021 9:17 am
Forum: C/C++
Topic: Detect number of presses to call functions.
Replies: 10
Views: 348

Re: Detect number of presses to call functions.

This kbhit() function might be useful (it uses the ncurses library): /* Code copied from Programmer's Guide to nCurses, by Dan Gookin * Alternative code without ncurses is available, but since I already * use ncurses in this program it's ok. */ int kbhit(void) { int ch, r; /* Turn off getch() blocki...
by buja
Thu Nov 11, 2021 9:57 am
Forum: Beginners
Topic: Why do a lot of I2C protocol tutorials combine a rasp pi and arduino?
Replies: 2
Views: 98

Re: Why do a lot of I2C protocol tutorials combine a rasp pi and arduino?

Raspberry Pi GPIO pins are 3.3 volts, Arduino (usually) 5 volts. So if a sensor needs 5 volts you cannot use it directly on a Pi and putting an Arduino between the sensor and the Pi is one option to tackle that problem. Using an Arduino for the low level stuff like reading sensors and a Pi for the d...
by buja
Mon Nov 08, 2021 10:40 am
Forum: Raspberry Pi OS
Topic: Heads up: new release!
Replies: 19
Views: 1178

Re: Heads up: new release!

Release date 30 October, pretty sneaky :!:
by buja
Sun Nov 07, 2021 11:26 am
Forum: General discussion
Topic: New P0 2 W
Replies: 14
Views: 635

Re: New P0 2 W

The sluggish communication with the Zero I have experienced too some time ago. It might have something to do with a Pi 3 (or other user) getting more capacity than a Zero. If the Zero connected first it was usually ok.
by buja
Sun Nov 07, 2021 11:22 am
Forum: General discussion
Topic: New P0 2 W
Replies: 14
Views: 635

Re: New P0 2 W

My new Pi Zero 2 does not see the WiFi on my new modem/router either, but it does see other networks (neighbours). On a Pi 3 I could see my WiFi is 5G and I read somewhere the Pi Zero does not work with that. I tested again with my old router and this time the Zero 2 connected to the 2.4 GHz WiFi wi...
by buja
Sun Nov 07, 2021 9:49 am
Forum: C/C++
Topic: IDE - GEANY
Replies: 8
Views: 456

Re: IDE - GEANY

In Code::Blocks you can set the parameters for the Run command under Project / Set programs' argument . Build options are available under Project / Build options . Geany 1.38 was released in October 2021, so it's very fresh. The website has release notes for the different versions so you can see wha...
by buja
Mon Nov 01, 2021 2:05 pm
Forum: Raspberry Pi OS
Topic: When will Raspberry Pi OS be taken seriously by the foundation?
Replies: 18
Views: 1469

Re: When will Raspberry Pi OS be taken seriously by the foundation?

A first time poster with the name of a well known "funny man" from The Big Bang Theory, I would not expect too much seriousness.
by buja
Sat Oct 23, 2021 7:25 am
Forum: General discussion
Topic: GPSD users: Time travel bug hitting this weekend
Replies: 32
Views: 1235

Re: GPSD users: Time travel bug hitting this weekend

stevend wrote:
Fri Oct 22, 2021 5:22 pm
Depends on how you use GPSD. From: https://www.theregister.com/2021/10/19/gpsd_bug_reset/
...
Good stuff! Not only this topic, but the above mentioned article as well, especially the cartoon at the end.
Be sure to read at least that!

Hopefully my systems look at a correctly updated time server.
by buja
Mon Oct 18, 2021 7:17 am
Forum: General discussion
Topic: Pi 3B+ SOLD OUT Worldwide
Replies: 17
Views: 1050

Re: Pi 3B+ SOLD OUT Worldwide

The Pi Hut as far as I know is an authourised seller, they are selling and are charging £33.90 inc VAT or $38.81. Yup, but I can only order one. And I need to ship it to the southern tip of Africa one at a time... and they don't have the option to ship to South Africa, so would have to go to USA fi...
by buja
Tue Oct 12, 2021 1:24 pm
Forum: General
Topic: Raspbian for Pico?
Replies: 34
Views: 1706

Re: Raspbian for Pico?

A Pico with an OS? Possible, but what is the point? I mean the Fuzix example is certainly interesting, but the $4 Pico needs a SD card + $7.50 MicroSD card breakout board, so the price is already going up significantly. Better and cheaper alternative: Pi Zero with RaspiOS Lite. Proven concept, work...
by buja
Tue Oct 12, 2021 11:18 am
Forum: General
Topic: Raspbian for Pico?
Replies: 34
Views: 1706

Re: Raspbian for Pico?

A Pico with an OS? Possible, but what is the point? I mean the Fuzix example is certainly interesting, but the $4 Pico needs a SD card + $7.50 MicroSD card breakout board, so the price is already going up significantly. Better and cheaper alternative: Pi Zero with RaspiOS Lite. Proven concept, works...
by buja
Sat Sep 18, 2021 8:02 am
Forum: Off topic discussion
Topic: R.I.P Sir Clive
Replies: 35
Views: 3352

Re: R.I.P Sir Clive

Making affordable hardware is a goal that Sinclair shared with the idea behind the Raspberry Pi. My first computer was a Sinclair QL. It was relatively cheap and had quite good software, but the hardware was not very robust. Especially the keyboard and the microdrives, a sort of endless magnetic tap...
by buja
Fri Aug 20, 2021 2:09 pm
Forum: Off topic discussion
Topic: Eben Upton speaks...
Replies: 26
Views: 2383

Re: Eben Upton speaks...

Just today I read that several car manufacturers (Toyota, Audi, BMW) are slowing down production, or suspending start-up after the summer break, because of the shortage of computer chips that are vital for the cars.
by buja
Mon Feb 15, 2021 11:54 am
Forum: General discussion
Topic: Database package?
Replies: 8
Views: 681

Re: Database package?

Heater wrote:
Mon Feb 15, 2021 8:47 am
Amazon's Redshift : https://aws.amazon.com/redshift/?whats- ... order=desc
...
Anything on this list of databases: https://db-engines.com/en/ranking

?
No. 7: Redis?
Edit: sorry, that's what the topic started with :)
by buja
Fri Feb 05, 2021 11:28 am
Forum: C/C++
Topic: Pi4 C library
Replies: 4
Views: 866

Re: Pi4 C library

You could take a look at the BCM2835 library (https://www.airspayce.com/mikem/bcm2835/).
But you should be able to make it work with wiringPi and PIGPIO too, so I guess there is something wrong with your code.
by buja
Mon Feb 01, 2021 1:15 pm
Forum: MicroPython
Topic: Weird Pi coding style
Replies: 5
Views: 805

Re: Weird Pi coding style

jahboater wrote:
Mon Feb 01, 2021 12:12 pm
:) Those redundant parentheses take an extra 135208 instructions to execute on a Pi4 :)
Oh? Not a very smart optimizer then ;)
by buja
Thu Jan 28, 2021 1:00 pm
Forum: General
Topic: New product Announcement!
Replies: 67
Views: 4118

Re: New product Announcement!

Some already do, you can purchase a Pi Pico with presoldered headers from Core-electronics Australia. I don't know about other retailers or countries, and can't say what sort of pricing you're looking at, but its possible to buy them. We sure do; our team had a lot of fun soldering headers on the p...
by buja
Wed Jan 27, 2021 9:18 pm
Forum: General
Topic: New product Announcement!
Replies: 67
Views: 4118

Re: New product Announcement!

I just ordered 2 Pico's and header sets plus an Explorer Base from Pimoroni. I thought I got a discount, but as it turns out they did not charge VAT after the Brexit. Now let's see how Dutch customs will handle it; VAT is OK, but I fear the handling & administration fee is going to hurt :| Stan...
by buja
Wed Jan 27, 2021 11:18 am
Forum: Beginners
Topic: Limiting a floating point to 6 decimal places
Replies: 3
Views: 232

Re: Limiting a floating point to 6 decimal places

It's even simpler than that (after I checked the round() function):

Code: Select all

t1_limited = round(t1_many, 6)
by buja
Wed Jan 27, 2021 11:14 am
Forum: Beginners
Topic: Limiting a floating point to 6 decimal places
Replies: 3
Views: 232

Re: Limiting a floating point to 6 decimal places

It's a bit crude, but it works:

Code: Select all

t1_many = 42.6032715468978
t2_many = -71.281517524387
print(t1_many, t2_many)

t1_limited = round(1000000 * t1_many) / 1000000
t2_limited = round(1000000 * t2_many) / 1000000
print(t1_limited, t2_limited)

Go to advanced search