Final project
For our final project, we’re going to use ChatGPT to produce a program that will do the following:
- Set a
message
variable tolocked
when the temperature is above 100 degrees - Set a
message
variable towarning
when the temperature is between 95 and 100 degrees - Set a
message
variable tosafe
when the temperature is below 95 degrees
Before you move on, try to write a prompt that can generate a program.
Prompt and code
For this project, we could use something like the following prompt:
Generate a Structured Text PLC program that will set a message to locked when a temperature variable is above 100, set a message to warning with the temperature variable is between 95 and 100, and set the message to safe when the temperature is under 95.
The code that ChatGPT will produce is as follows:
PROGRAM TemperatureMonitoring VAR Temperature : REAL := 0.0; (* Temperature variable *) ...