Technoman
Senior Member
Hi,
As many articles are relating code generation with ChatGPT (OpenAI), I gave a try.
I supplied the following description :
"basic code for a light activated switch Picaxe 08M2 240V SSR connected to C.2 LDR connected to C.1 hysteresis "
Generated code :
The result is not too bad. Even after slightly modifying the demand, it was not able to setup constants and use variables instead. Also an arbitrary value exceed 8 bits (threshold).
As many articles are relating code generation with ChatGPT (OpenAI), I gave a try.
I supplied the following description :
"basic code for a light activated switch Picaxe 08M2 240V SSR connected to C.2 LDR connected to C.1 hysteresis "
Generated code :
Code:
' Declare variables
dim threshold as word ' threshold value for LDR
dim hysteresis as word ' hysteresis value
' Set threshold and hysteresis values
threshold = 500
hysteresis = 50
main:
' Read the value of the LDR
readadc C.1, b0
' Check if the LDR value is above the threshold + hysteresis
if b0 > threshold + hysteresis then
high C.2 ' turn on the SSR
elseif b0 < threshold - hysteresis then
low C.2 ' turn off the SSR
endif
pause 500 ' wait for 500 milliseconds before checking again
goto main ' loop back to the start
The result is not too bad. Even after slightly modifying the demand, it was not able to setup constants and use variables instead. Also an arbitrary value exceed 8 bits (threshold).
Last edited: