News:

Let's find out together what makes a PIC Tick!

Main Menu

ChatGPT

Started by Gary Scott, Feb 20, 2023, 04:04 PM

Previous topic - Next topic

Gary Scott

What are ya'll using ChatGPT for if anything? Will this create brain dead humans?
It appears that it can program code, what will the future hold for jobs? Not that it matters to me as I'm retired. :-(

Here is a blink led example with micro python for example:

from machine import Pin
import time

led = Pin(25, Pin.OUT)

while True:
    led.toggle()
    time.sleep(0.5)

It's also aware of Proton Basic

Device = 16F15313

Config OSC = INTOSC
Config MCLRE = OFF

Dim LED As PORTC.5

Do
    LED = 1
    DelayMS 500
    LED = 0
    DelayMS 500
Loop

RGV250

#1
There is another thread on here somewhere about this.
I really get annoyed when people call then artificial intelligence. I was thinking about this and all they seem to be is copy and paste machines with a bit of an algorithm that makes it look like it is actually working things out.
I would lay money that if you gave it the Positron manual and a few examples (no internet connection at all) and then asked it to write a program for something that the examples did not cover it would not have a clue which is where the intelligence would come in.

But as for creating brain dead morons, I fear it is already too late even without ChatGPT, think Twitt(er), TikTok and Facebook.

Bob

Gary Scott

Quote from: RGV250 on Feb 20, 2023, 04:26 PMThere is another thread on here somewhere about this.
I really get annoyed when people call then artificial intelligence. I was thinking about this and all they seem to be is copy and paste machines with a bit of an algorithm that makes it look like it is actually working things out.
I would lay money that if you gave it the Positron manual and a few examples (no internet connection at all) and then asked it to write a program for something that the examples did not cover it would not have a clue which is where the intelligence would come in.

But as for creating brain dead morons, I fear it is already too late even without ChatGPT, think Twitt(er), TikTok and Facebook.

Bob

ChatGPT seems to agree with you, here is a answer I got when I ask it tough specific questions.
 
QuoteI'm sorry, but as an AI language model, I don't have the ability to update or modify myself to support any particular compiler

John Lawton

#3

xldaedalus

ChatGPT does write some Positron Basic, but only knows it a Proton Basic.  Here is a Procedure I asked it to write for me.

By the way, it does learn, so if you correct it, or tell it a better way to do things, it will remember.  For example, the first time I asked it, to increment the buffer pointer, it used Index = Index + 1.  I told it, "instead of using "Index = Index + 1", a better way to write that is to use "INC Index".  Note below, that's what it did.

It may be that even a faster way to do this is to use AddressOf

In this example, it does not know how to actually create the interrupt with Context Save, Contex Restore, or to use HIGH or LOW priority interrupts, but we might be able to teach it how to do these things.  We could notify the creators of ChatGPT and ask them to update.

In any case, its obviously doesn't give you perfect code, but it gives you a great place to start.  No different than having it write a story, song or poem for you.

Sure! Here's an example of an interrupt routine that receives a 1024 byte string by SPI and places it in a 1024 byte array:


' Define constants for SPI configuration
Const SPI_MASTER_MODE = 1
Const SPI_CLK_IDLE_HIGH = 1
Const SPI_SAMPLE_AT_END = 1

' Define the size of the data buffer
Const BUFFER_SIZE = 1024

' Declare a buffer to hold the received data
Dim Buffer(BUFFER_SIZE) As Byte

' Declare a variable to keep track of the current position in the buffer
Dim Index As Word

' Configure the SPI module
SPIMode = SPI_MASTER_MODE
SPIIdle = SPI_CLK_IDLE_HIGH
SPISample = SPI_SAMPLE_AT_END

' Define the interrupt routine for SPI data reception
@Interrupt
Procedure SPIReceiveInterrupt()

    ' Check if the SPI module is full
    If SPIFull Then
        ' Read the byte from the SPI register and store it in the buffer
        Buffer(Index) = SPIRead
       
        ' Increment the buffer index
        INC Index
       
        ' If we have received all the bytes, disable the interrupt
        If Index >= BUFFER_SIZE Then
            Disable Interrupt
        EndIf
    EndIf

EndProc

' Enable the SPI receive interrupt
Enable Interrupt

' Wait for the interrupt to complete and all bytes to be received
While Index < BUFFER_SIZE
Wend

' Disable the SPI receive interrupt
Disable Interrupt

' Do something with the received data in the buffer
' ...
In this example, we first define some constants that configure the SPI module. We also define the size of the data buffer, which is set to 1024 bytes. We then declare a byte array called Buffer with the same size as the data buffer, and a variable called Index that will be used to keep track of the current position in the buffer.

Before entering the interrupt routine, we configure the SPI module using the constants we defined earlier.

The SPIReceiveInterrupt procedure is defined as the interrupt routine for SPI data reception. When the interrupt is triggered, the procedure checks if the SPI module is full using the SPIFull function. If the module is full, the procedure reads the byte from the SPI register using the SPIRead function and stores it in the buffer at the current index using Buffer(Index) = SPIRead. It then increments the index using INC Index.

If all 1024 bytes have been received, the interrupt is disabled using the Disable Interrupt statement. Otherwise, the interrupt routine will continue to execute until all 1024 bytes have been received.

After defining the interrupt routine, we enable the SPI receive interrupt using Enable Interrupt. We then wait for the interrupt routine to complete and all bytes to be received using a While loop that checks if the index is less than BUFFER_SIZE.

Once all 1024 bytes have been received and stored in the Buffer array, the interrupt is disabled using Disable Interrupt. At this point, you can do something with the received data in the buffer.

Note that this example assumes that the SPI module is set up correctly and that data is being received at the expected rate. You may need to adjust the SPI configuration or interrupt routine to match the specific requirements of your system.
Never, never, never give up

xldaedalus


Write a procedure that will find the name Lee in the string of names "ZakTomArthurLeeBillJaneCranston" and return the number of the name or 0 if not found

Sure, here's an example procedure that will find the name "Lee" in a string of names and return the number of the name or 0 if not found:

vbnet
Copy code
' Define the string of names
Dim Names As String = "ZakTomArthurLeeBillJaneCranston"

' Define the target name
Dim TargetName As String = "Lee"

' Define the name counter
Dim NameCounter As Byte = 1

' Define the index counter
Dim Index As Byte = 1

' Define the name number result
Dim NameNumber As Byte = 0

' Loop through each character in the string
For Index = 1 To Len(Names) - Len(TargetName) + 1

    ' Check if the target name is found at this position
    If Mid(Names, Index, Len(TargetName)) = TargetName Then
        ' If found, set the name number result and exit the loop
        NameNumber = NameCounter
        Exit For
    EndIf
   
    ' If the target name is not found at this position, increment the name counter
    If Mid(Names, Index, 1) = " " Then
        NameCounter = NameCounter + 1
    EndIf

Next Index

' Print the result
Print "Name number: "; NameNumber
In this example, we first define the string of names and the target name that we want to find. We also define a name counter that will be used to keep track of the current name number, an index counter that will be used to loop through each character in the string, and a name number result that will be set to the number of the name if it is found.

We then loop through each character in the string using a For loop that goes from 1 to the length of the string minus the length of the target name plus 1. This ensures that we only check positions in the string where the target name could potentially be found.

For each position in the string, we check if the target name is found at that position using the Mid function. If the target name is found, we set the name number result to the current name number and exit the loop using the Exit For statement.

If the target name is not found at the current position, we increment the name counter if the current character is a space. This allows us to keep track of the current name number as we loop through the string.

Finally, we print the name number result. If the target name is not found in the string, the name number result will be 0.




leefparker@yahoo.com
How does this procedure know when a name in the given string starts and ends?

In the procedure I provided, the assumption is that each name in the string is separated by a space character. The procedure uses this assumption to determine when a name starts and ends.

The For loop in the procedure iterates through each character in the string, and at each iteration, it checks if the current character is a space. If the current character is a space, it means that the previous name has ended and a new name is starting. The NameCounter variable is used to keep track of the current name number, and it is incremented each time a space is encountered.

So, in summary, the procedure assumes that each name in the string is separated by a space character, and it uses this assumption to determine when a name starts and ends.

Note my Query back to ChatGPT about how the Procedure knows where a name stops and starts.  So, per it's answer, if I change the string from "ZakTomArthurLeeBillJaneCranston" to "Zak Tom Arthur Lee Bill Jane Cranston ", the above Procedure has a good chance of working correctly right out of the gate.
Never, never, never give up

xldaedalus

It didn't write a procedure either, but the code could be placed in a procedure. So, I asked it to do this, and I updated the name string with spaces.

Sure, here's the updated procedure ReturnNameNumber that takes a target name as an argument and returns the number of the name in the string or 0 if not found, using the updated string of names with spaces between each name:

vbnet
Copy code
' Define the ReturnNameNumber procedure
Procedure ReturnNameNumber(TargetName As String)

    ' Define the string of names
    Dim Names As String = "Zak Tom Arthur Lee Bill Jane Cranston "

    ' Define the name counter
    Dim NameCounter As Byte = 1

    ' Define the index counter
    Dim Index As Byte = 1

    ' Define the name number result
    Dim NameNumber As Byte = 0

    ' Loop through each character in the string
    For Index = 1 To Len(Names) - Len(TargetName) + 1

        ' Check if the target name is found at this position
        If Mid(Names, Index, Len(TargetName)) = TargetName Then
            ' If found, set the name number result and exit the loop
            NameNumber = NameCounter
            Exit For
        EndIf

        ' If the target name is not found at this position, increment the name counter
        If Mid(Names, Index, 1) = " " Then
            NameCounter = NameCounter + 1
        EndIf

    Next Index

    ' Print the result
    Print "Name number: "; NameNumber

EndProcedure
To use the updated ReturnNameNumber procedure, you can call it with the target name as an argument. For example, to find the number of the name "Lee" in the string of names, you would call the procedure as follows:

scss
Copy code
ReturnNameNumber("Lee")
This would print the number of the name "Lee" in the string. If the name is not found in the string, the procedure will return 0.
Never, never, never give up

RGV250

Hi,
I am still not convinced it is intelligent, in the first post Const is not used in Positron, it should be declare. Then the interupt appears to be a prceedure and it has @interrupt and enable / disable iterrupt without a macro etc so if you did ask it to write Positron code it failed miserably.
Also it seems to start with VBNet, surely if it were intelligent the first question to ask before writing any code is what language you want it to be written in.
If I was at work and wrote a load of code and then found out it was for a different processor I would be sacked.

Bob

xldaedalus

#8
Well, if you wrote a lot of code for the wrong compiler, you wouldn't be very good at writing code.  After all, what kind of dummy doesn't test his code and debug it before submitting it as finished.  Anyone who uses code from any source, especially from an AI source, who assumes the code works and turns it in as his own, is incompetent and should be sacked. 

And what you said about the kids using it to do there homework isn't about being lazy, its about efficiency.  This is the same argument I heard my teachers say about using calculators when I was young. Yeah, I know what you'll say "people have to learn how to do math to understand its concepts."  I don't argue that, but no one does that in the real world, so the kids that learn to use the calculator to do the grunt work, get better gigs because they are faster.

At the moment, AI is little better than a calculator, and because its answers are ever so much more complex, its going to be wrong, a lot more often - in the beginning. It's not always going to be that way. Match a kid doing long division calculate a calculus derivative with paper and pencil with a kid who know how to use MatLab.  Which do you think will get the job in today and future markets?  Right, so kids in the future who don't know how to widdle CORRECT data from an AI source will be left behind.  I'm not saying this is right, its just the way it is. I'm self-taught EE/CE.  I couldn't get a gig at Google or Apple because I have a degree in the Arts. It's stupid a company won't hire based on experience but on education, when for most their "education" is irrelevant.   Because solving problems quickly and efficiently is not taught, but learned through "experience."  The same way AI learns, but at a rate much faster than the human mind.

Clearly, you are against AI.  That's OK.  If people don't like using AI, they don't have use it, that's their choice.  But all the nay-saying in the world won't change the fact AI is in our future.  It won't be too many years before a coder doesn't know how to use AI to his advantage, he's going to be sacked.  IIf you don't think so, think about how many people in the world, not just people you know, still do long division and multiplication with pencil and paper, how many even type on typewriters, how many write "letters" of any kind to anyone.

Charles Darwin said, "It is not the strongest or the most intelligent who will survive but those who can best manage change."

As a final comment, to an obvious point.  Show me someone who thinks writing a computer program will be easy, in any language, including AI, now or in the future, and I'll show you a fool.
Never, never, never give up

RGV250

Hi,
You seem to be missing the point that once everyone only knows how to copy and paste they will not know when it gives the wrong answer, I still use a pen and paper (a strange concept for younger people) and do maths on paper. Mainly as I cannot be bothered to look for the calculator but at least I know how to do it and more important I also have an idea what the result should be if my working is wrong which a lot of people who have not done it manually will not be able to know.
I do not know but I would bet it was a human who found out there was a floating point error in the x87 co processor way back, would AI know that it had gone wrong.
Secondly what will drive innovation once we are all copy and paste muppets.

The reason I mentioned the wrong language is that you are saying it is Proton/Poitron code but I could not recognise it as such, there are so many mistakes it could be any language. It also always starts with vbnet and copy code, it is not commented out so I have to assume that is part of the code.


Bob

Gamboa

Hi,

Artificial Intelligence has little intelligence and much artificial. It is, after all, a machine. Today it is wrapped in a magical sphere with a lot of marketing. It is a machine like a Casio calculator was in the 70s. It will surely increase the productivity of human labor and change our lives. But we must not lose sight of what it is and who controls it: the human.
AI will help humans continue to develop great things for their benefit that today we don't even think could exist. But we cannot lose perspective, the AI will work for us like a tractor, a car or a blender. AI is one more tool for humans, although it is very powerful and potentially dangerous. The use that humans make of this tool will bring great advances or great catastrophes.
Until now the great advances have been provided by humans, some privileged humans. It is not necessary to remember the illustrious surnames of these humans that I refer to as Einstein, Tesla, Edison, Curie, Ramón y Cajal or Fleming, to name a few. My personal opinion is that behind the AI there will continue to be men and women driving this wonderful machine.

This text has been written entirely in Spanish and has been translated into English by some kind of AI. Friends from the UK, USA and Australia you can now say how well or how badly this AI has worked.

Regards,
Gamboa
Long live for you

ken_k

Wait until they install the positronic brain!

John Drew

#12
Gday Gamboa,
It worked very well. I didn't pick it, there have been big advances in translation..
I tried ChatGPT the other day.
It didn't know about the recently launched Japanese amateur moon lander. I then referred it to the name of the lander in Wikipedia. I re-asked the question and it came up with a reasonably good response. So it does learn.
But as mentioned it's only a machine. It may be useful in future, at present it's a curiosity.
Teachers will need to rethink how they deal with students' homework.
John
(Once a teacher)

PS Ken, I'll dig out my Asimov science fiction. Loved the 3 laws.

charliecoutas

G'day John

I read somewhere that some UK learning establishments are going to allow students to submit essays produced by ChatGPT on the basis that devices like calculators can now be used, whereas once they were not. I suspect that their reasoning is that the students will learn from studying the output of ChatGPT. Hmmmm, I'm not so sure.

Charlie

John Lawton

Quote from: charliecoutas on Mar 04, 2023, 11:14 AMI suspect that their reasoning is that the students will learn from studying the output of ChatGPT. Hmmmm, I'm not so sure.
I suspect ChatGPT will be doing more learning than the students. I'm not sure of the difference between employing a ghost writer and using ChatGPT.

John Drew

#15
G'day Charlie,
The Department of Education, some private schools and the three Universities in our State have all permitted its use.
I think it's a matter of accepting reality. The bots are unstoppable.
CHATgpt and the Apple and Google variants will only get "better" whatever that means. We seemed to have survived the introduction of ball point pens, calculators, computers and the Internet so I suppose we'll survive ChatGPT etc.

Students already copy and paste from Internet searches, books etc.
It will come down to how teachers deal with it. It's a piece of cake to distinguish between a student's piece of writing and that produced by a bot - at least for Primary and Secondary Students. ChatGPT produces mature, grammatically correct text with an absence of typos and spelling errors. It does have errors of fact though, but it'll get better.

Teachers will do the same as they currently do when recognising plagiarism and there is no shortage of strategies.
This is starting to sound like a lecture :-)

ChatGPT, has made me think back to how I'd deal with it as a teacher or School Principal. Sometimes I miss the profession but then I see all the complications facing teachers in today's world. It is not easy.
Cheers from Oz,
John

RGV250

Hmm, look how the internet has turned out, from what started out as a really good idea for forums like this. Now apart from the forums it is a hive of porn sites, spam emails, false information and adverts.

Almost forgot, click bait.

Bob

charliecoutas

That's a nice comparison John(L): employing a ghost writer or using ChatGPT. I don't see much difference either.

John (D): I used to teach a module for Thames Valley University many years ago. One day, a boy who had trouble stringing ten words together, produced an essay. It was brilliant and I immediately smelled a rat. It was the early days of search engines and I soon found the original, from a USA company. I reported it to my supervisor and the boy was thrown off the course. Only to have his mother raise merry hell with somebody senior and he was put back on the course.


John Drew

Very true Bob and Charlie.

@Bob Yes, the Internet has been commandeered by the crims, the greedy and the nasty. There has been a decline in community standards thanks to social media especially. Fortunately there are some good aspects. e.g. all the datasheets at my disposal, this helpful forum, and good information to be found if we know where to look with our eyes wide open.

@Charlie One of the big problems in education is as described by you. We need more tough love and less of the "My child would never do that, it's someone else who must've punched the other kid", "My child wouldn't cheat" etc.
 
John

Gary Scott

One last post on the subject.  ???

Learn Prompting
https://learnprompting.org/docs/intro