Has anyone tried AI with PICBASIC


+ Reply to Thread
Results 1 to 40 of 132

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,686

    Default Re: Has anyone tried AI with PICBASIC

    Quote Originally Posted by rsocor01 View Post
    writing code involves a lot of troubleshooting and problem solving. I don't think that we are there yet with AI.
    you will be able to detect when AI is "ready",
    it will cost an arm and a leg to use it
    Warning I'm not a teacher

  2. #2
    Join Date
    Feb 2013
    Posts
    1,154

    Default Re: Has anyone tried AI with PICBASIC

    Another example when AI code works on PBP - Multiple ADC button reading and debouncing:

    Code:
    ReadButton:
        TempE = 0
    
    
        ' Repeat check 5 times for debounce
        For cnter = 1 to 5
            ADCIN 0, adcval        ' Read from AN0 (adjust channel if needed)
    
    
            If (adcval >= 230) And (adcval <= 270) Then
                TempE = 1
            ElseIf (adcval >= 290) And (adcval <= 330) Then
                TempE = 2
            ElseIf (adcval >= 380) And (adcval <= 440) Then
                TempE = 3
            ElseIf (adcval >= 580) And (adcval <= 700) Then
                TempE = 4
            Else
                TempE = 0
            EndIf
    
    
            ' If reading doesn’t match previous stable result, reset debounce
            If cnter = 1 Then
                E = TempE
            Else
                If TempE <> E Then
                    E = 0
                    Return
                EndIf
            EndIf
            Pause 10    ' small delay between samples
        Next cnter
    
    
    Return
    However, it still needed tweaking, because it used counter as variable name, which is reserved word, so I've changed it to cnter and this code works and far more efficient than my own - shown below:

    Code:
    keyhandler:
    babo:
    adcin 0,adcval
    if adcval<100 then goto resetvar 'reset internal debounce variables 
    if adcval>230 and adcval<270 then a=a+1
    if adcval>290 and adcval<340 then b=b+1
    if adcval>385 and adcval<440 then c=c+1
    if adcval>570 and adcval<660 then d=d+1
    cnter=cnter+1 'increase loop iteration counter
    if cnter=100 then goto analyzer 'if enough time pressed, go to analyzer
    goto babo
    Analyzer:
    ' --- Comparison Logic ---
    IF (A = B) OR (A = C) OR (A = D) OR (B = C) OR (B = D) OR (C = D) THEN
        E = 5                              ' Tie detected
    ELSE
        IF (A > B) AND (A > C) AND (A > D) THEN
            E = 1                          ' A is greatest
        ELSEIF (B > A) AND (B > C) AND (B > D) THEN
            E = 2                          ' B is greatest
        ELSEIF (C > A) AND (C > B) AND (C > D) THEN
            E = 3                          ' C is greatest
        ELSEIF (D > A) AND (D > B) AND (D > C) THEN
            E = 4                          ' D is greatest
        ELSE
            E = 5                          ' Safety fallback (should not reach here)
        ENDIF
    ENDIF
    resetvar:
    cnter=0
    'a=0
    b=0
    c=0
    d=0
    return

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170

    Default Re: Has anyone tried AI with PICBASIC

    I think the part of if-then block can be faster with smaller code size like this:

    Code:
    If adcval<230 then TempE=0
    if adcval >= 230 Then TempE = 1
    If adcval >= 290 Then TempE = 2
    If adcval >= 380 Then TempE = 3
    If adcval >= 580 ThenTempE = 4
    if adcval > 700 then  TempE = 0
    But since there will be quantisizing error and the adcval may play at least one bit, this will fail most of the time:

    Code:
         ' If reading doesn’t match previous stable result, reset debounce
            If cnter = 1 Then
                E = TempE
            Else
                If TempE <> E Then
                    E = 0
    this part should allow a margin of at least 2 digit play for adcval.

    Ioannis

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704

    Default Re: Has anyone tried AI with PICBASIC

    Quote Originally Posted by richard View Post
    you will be able to detect when AI is "ready",
    it will cost an arm and a leg to use it
    True. Unless they have open source code like in Github. I think that eventually we will get there, but we are not there yet. Maybe the new "programmer" in the future will be the professional that can ask AI how to write very complex programming code for a complex project.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  5. #5
    Join Date
    Feb 2013
    Posts
    1,154

    Default Re: Has anyone tried AI with PICBASIC

    There are some open source AI projects, like Fooocus already. You can download and run them locally, without internet.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,686

    Default Re: Has anyone tried AI with PICBASIC

    AI is just unregulated theft of intellectual property with no payment for or even acknowledgement of the source.[programming is IP and an art form too]
    The AI generated result is used with no consequences for its impact and no need to even identify that it was AI generated. A brave new world

    Warning I'm not a teacher

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170

    Default Re: Has anyone tried AI with PICBASIC

    Quote Originally Posted by richard View Post
    AI is just unregulated theft of intellectual property with no payment for or even acknowledgement of the source.[programming is IP and an art form too]
    The AI generated result is used with no consequences for its impact and no need to even identify that it was AI generated. A brave new world
    Very true.

    My other job has to do with book publishing. Many well known publishers have sued the AI companies for this exact theft. Serious problems have risen in every aspect of intellectual property (writing, programming, art designing etc).

    Ioannis

  8. #8
    Join Date
    Feb 2013
    Posts
    1,154

    Default Re: Has anyone tried AI with PICBASIC

    and that is funny thing.
    Human can learn from other works and create his art, literature or music based on that - this is fine. But same not fine for AI?

  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704

    Default Re: Has anyone tried AI with PICBASIC

    Quote Originally Posted by CuriousOne View Post
    and that is funny thing.
    Human can learn from other works and create his art, literature or music based on that - this is fine. But same not fine for AI?
    Humans can get sued for plagiarism, patent infringement, etc. AI cannot.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

Similar Threads

  1. conversion from picbasic to picbasic pro
    By winjohan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st November 2011, 19:00
  2. Proton PICBASIC vs MeLabs PICBASIC
    By Fredrick in forum General
    Replies: 22
    Last Post: - 11th January 2008, 22:51
  3. PICBasic Pro vs Proton PICBasic
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd November 2006, 17:11
  4. picbasic 2.46
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th April 2005, 04:34
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 22:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts