DeepSeek writing Picaxe code

fernando_g

Senior Member
Can you write a Picaxe program to drive a buzzer.

Code:
' PICAXE Buzzer Program
' This program makes a buzzer connected to pin B.1 beep every second.

symbol buzzer = B.1   ' Define the buzzer pin (change to the pin you are using)

main:
    high buzzer       ' Turn on the buzzer
    pause 500         ' Wait for 500 milliseconds (0.5 seconds)
    low buzzer        ' Turn off the buzzer
    pause 500         ' Wait for another 500 milliseconds
    goto main         ' Repeat the loop
 
I tried a few times with ChatGPT, but the code was full of problems and that was the case for simple GPIO toggling. It seems that there are too few Picaxe code samples available out there in order to properly train any model to generate Picaxe code.
 
I Asked if it could write code to send an SMS:

Sending an SMS message using a PICAXE microcontroller typically requires interfacing with a GSM module (e.g., SIM800, SIM900, or similar). The PICAXE will send AT commands to the GSM module to initiate the SMS sending process.

Below is an example PICAXE BASIC code to send an SMS message using a GSM module:


PICAXE Code to Send an SMS​



' PICAXE Code to Send an SMS using a GSM Module
' Connect the GSM module's TX to PICAXE serial input (e.g., C.6)
' Connect the GSM module's RX to PICAXE serial output (e.g., C.7)
' Ensure the GSM module is powered properly (check voltage requirements)

symbol gsmTX = C.6 ' GSM module TX connected to PICAXE serial input
symbol gsmRX = C.7 ' GSM module RX connected to PICAXE serial output
symbol phoneNumber = "+1234567890" ' Replace with the recipient's phone number
symbol smsMessage = "Hello from PICAXE!" ' SMS message to send

main:
serout gsmTX, T9600_8, ("AT+CMGF=1", 13, 10) ' Set GSM module to text mode
pause 1000 ' Wait for the module to respond

serout gsmTX, T9600_8, ("AT+CMGS=", 34, phoneNumber, 34, 13, 10) ' Specify recipient number
pause 1000 ' Wait for the module to respond

serout gsmTX, T9600_8, (smsMessage, 26) ' Send SMS message (Ctrl+Z = 26 to end)
pause 5000 ' Wait for the SMS to be sent

goto main ' Loop (optional)

Explanation:​

  1. serout: Sends serial data to the GSM module.
    • T9600_8: Serial protocol (9600 baud, 8 data bits, no parity, 1 stop bit).
    • 13, 10: Carriage return (CR) and line feed (LF) to simulate pressing "Enter."
  2. AT Commands:
    • AT+CMGF=1: Sets the GSM module to text mode for sending SMS.
    • AT+CMGS="+1234567890": Specifies the recipient's phone number.
    • Ctrl+Z (ASCII 26): Indicates the end of the SMS message.
  3. Pauses: Allow time for the GSM module to process commands.

Wiring:​

  1. GSM Module to PICAXE:
    • GSM TX → PICAXE Serial Input (e.g., C.6).
    • GSM RX → PICAXE Serial Output (e.g., C.7).
    • GSM GND → PICAXE GND.
  2. Power:
    • Ensure the GSM module is powered with the correct voltage (e.g., 3.7V–4.2V for SIM800/SIM900).
    • Use a separate power supply if the PICAXE cannot provide sufficient current.
  3. Antenna:
    • Attach an antenna to the GSM module for proper signal reception.

Notes:​

  • Replace "+1234567890" with the actual recipient's phone number in international format (e.g., +441234567890).
  • Ensure the GSM module is properly configured (e.g., baud rate, SIM card inserted, network registered).
  • Test the GSM module with a terminal program (e.g., PuTTY) to verify AT commands before integrating with the PICAXE.
 
I tried a few times with ChatGPT, but the code was full of problems and that was the case for simple GPIO toggling. It seems that there are too few Picaxe code samples available out there in order to properly train any model to generate Picaxe code.

Nice to hear that AI hasn't replaced us old guys.


Yet.
 
It's going to happen eventually. It's already happening on other domains, like web applications with JavaScript.
What worries me the most is that the newer generation using those tools are skipping the "learning" part and just "implement" what the AI told them. This will, most likely, lead to two problems:
Young engineers without proper knowledge
Lack of new code for the AI to train on.
 
Too much "help" leads to ignorant workers who do NOT know where or how to research answers. Those of us who wrote high Scholl and college papers by doing research "in the stacks" know where and how to find things because you need a good vocabulary to find the things you need when searching from the entries in the card catalog and the indices in the books the card catalog pointed you to.

Wonder how many people under maybe 30 who have no idea what I'm talking about...
 
AI is a good tool in the hands of people who can do without it. Robot translators are too. Both save a lot of time and typing.
In the hands of people who can't do without it, you end up with something like this:

 
Back
Top