Writing bit-bang I2C XC8 code

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,629
I was really struggling to write a bit-bang I2C for a 16x02 LCD. I searched for any examples on www without finding anything suitable.
Putting that search in google, AI came up with some code which needed only minor changes to make it work. Then I wanted an 80 step bargraph on the LCD and once again the google AI produced.

So AI is better than me at writing such code. Colour me impressed!
 

nsaspook

Joined Aug 27, 2009
16,341
I was really struggling to write a bit-bang I2C for a 16x02 LCD. I searched for any examples on www without finding anything suitable.
Putting that search in google, AI came up with some code which needed only minor changes to make it work. Then I wanted an 80 step bargraph on the LCD and once again the google AI produced.

So AI is better than me at writing such code. Colour me impressed!
No, the AI is not better than you. A human, like you, is source of the learning data (there are a huge number of good bit-bang I2C examples on the web) for the machine. It played the match-game to your requests.

It should not be shocking that people have written the good code examples the LLM used. You need to upgrade your search-foo. :D
 
No, the AI is not better than you. A human, like you, is source of the learning data (there are a huge number of good bit-bang I2C examples on the web) for the machine. It played the match-game to your requests.

It should not be shocking that people have written the good code examples the LLM used. You need to upgrade your search-foo. :D
I think AI is better than humans .... its really is .... I think the programming career is over ..... just like cameraman, writer, blogger etc .... AI has eaten them all ....

Initially, we had machine language 0 and 1 ..... then we got assembly ..... then the C language ..... and now we just need to program in simple plain language(English) .... :D
 

nsaspook

Joined Aug 27, 2009
16,341
I think AI is better than humans .... its really is .... I think the programming career is over ..... just like cameraman, writer, blogger etc .... AI has eaten them all ....

Initially, we had machine language 0 and 1 ..... then we got assembly ..... then the C language ..... and now we just need to program in simple plain language(English) .... :D
English is a horrible programming language and would only be selected by those that don't really understand the basics of computer science. Far too much ambiguity and imprecision. Spoken languages carry vital information with tonalities and other suttile audio and body clues that just make it a bad fit for structured computer programming.

https://www.lesswrong.com/posts/Gid...rrible-programming-language-and-other-reasons
English is a Terrible Programming Language—And other reasons AI won't displace programmers
Because that’s another thing that people are confused about when it comes to programming, and this is something that even programmers don’t all recognize. The code isn’t for the computer—it’s for you. It’s for humans. If the coding language was meant for the computer, we would all be writing in pure binary instead of these abstracted and symbolic languages. The Python/C++/whatever-code isn’t some obstacle that we are trying to overcome. The code is the interface that we designed to be able to program the computer. It’s what we need. It’s objective, explicit, unambiguous, (relatively) static, internally consistent, and robust. English has none of these properties—it’s subjective, meaning is often implicit, and ambiguous, it’s always changing, contradictions appear, and its structure does not hold up to analysis.
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,629
No, the AI is not better than you. A human, like you, is source of the learning data (there are a huge number of good bit-bang I2C examples on the web) for the machine. It played the match-game to your requests.

It should not be shocking that people have written the good code examples the LLM used. You need to upgrade your search-foo. :D
If what it served up for me was something it found on www then it is a lot better than me at finding the good stuff.
 

nsaspook

Joined Aug 27, 2009
16,341
If what it served up for me was something it found on www then it is a lot better than me at finding the good stuff.
Not really. WWW is filled with misinformation, malinformation, disinformation and totally crazy garbage. Without understanding, it only finds what's popular, not what's correct and good.
Your applications were popular so there are lots of hopefully actually working versions in the wild that were used to train the LLM on. If it works as a search tool for you, it's a win. If you're doing something unique, it's a lot less helpful as a tool.
 
Last edited:
English is a horrible programming language and would only be selected by those that don't really understand the basics of computer science. Far too much ambiguity and imprecision. Spoken languages carry vital information with tonalities and other suttile audio and body clues that just make it a bad fit for structured computer programming.

https://www.lesswrong.com/posts/Gid...rrible-programming-language-and-other-reasons
English is a Terrible Programming Language—And other reasons AI won't displace programmers
We don't need a cameraman these days but obviously a drone operator should know about the angles to capture image/video ..... Btw helicopter for video is completely out of fashion ....

On the same pattern, we need programmers but just to get code from AI and then modify it a little .... soon programmers will become helicopters .... :D
 

nsaspook

Joined Aug 27, 2009
16,341
We don't need a cameraman these days but obviously a drone operator should know about the angles to capture image/video ..... Btw helicopter for video is completely out of fashion ....

On the same pattern, we need programmers but just to get code from AI and then modify it a little .... soon programmers will become helicopters .... :D
Sure.

It's mainly Tech-Meth.
 

panic mode

Joined Oct 10, 2011
5,017
an interesting question could be (but it is not) about human-AI competition at writing code for something completely new (vener done before). question is about getting AI to drop some ready to try code about something already done millions of times. in this arena, AI will outperform just about every human... so from perspective of a casual programmer or someone that barely touches keyboard, I is a quite a miracle. one can explain in two sentences what the goal is and get something workable, few more sentences can have it refined. and for many objective is not to get entire code 100% right but something that has nailed basic syntax and structure, anything beyond is a bonus.
 
i find it amazing how some will stick to their fixed belief and continue to broadcast their own dogmatic view rather than apply scientific method and just give is a fair chance and then make comments.
to be honest it was not long ago i was thinking the same. but over the past two years i gave it a chance on few occasions and while not every test was a success more than half was pretty impressive. that is statistically significant.

my point is that even the very first post in this topic is a report by someone that did give it a chance and report was positive outcome.
i too gave it a test ride more than once...

was it perfect on fist try? not exactly.
was there a case where result was nearly perfect on first try? yes.
was it faster? sometimes.
was it better? it depends. it is clear that pro would still win over AI. (at least in resource limited free edition) but... it is good enough to not be kicked to curb or mocked.
i have been testing it not just to write code but to troubleshoot circuits. technology is literally in its genesis stage and still far from perfect. but even in this early stage it has proven to be useful and offer valuable feedback.
 
ok.. just did another test with random hardware from my drawer.

test subject was Google AI and i was completely taking back seat - only making requests in plain English.

AI suggested how to connect things, deal with missing driver, etc. before providing error free code sample.
and when i asked for change to also show graph, it proceeded in same fashion. it provided modified code that was also 100% bug free and run on first try.

examples like this or bit banging I2C are not exactly rocket science. besides, there are plenty of examples online that AI could have simply 'borrowed'.
but for noob trying to make something work, or someone that only programmed in some other language, this is more than adequate to put something together - without writing single line of code.

" how to connect ESP32 DevKit1 with DS18B sensor and oled display 128x32?"


1782093405566.png

" board is not yet recognized. device manager shows yellow exclamation point mark over "CP2102 USB to UART Bridge Controller"


1782093461667.png

1782093552260.png

" that is nice but 40% or so of the right side of display is unused. can you add in there graph that shows last 30-40seconds of temperature with range 10-50degC?"


1782093583620.png

as said i grabbed first things i saw in the drawer. so no 4k7 but pair of 2k2 did the trick...
 

Attachments

Top