please try pleasedontcode.com as alternative to chatgpt
const unsigned long interval = 500; // 2 Hz
Ha.
Ha-ha.
Ha-ha-ha.
Please don't bother.
No I won't because I would have to register.
I don't register without knowing the internals.
You have at least to provide 3 examples with screenshots of what this webiste does
Why not you go for temporary email for the same?
too much hassle.
This company offers a service.
For me the service starts at good and detailed information
I tried out and I don't feel it is good as OP is saying not to use chatpgt or providing an alternate as I have used . I stop at the just at the board selection despite for my eagerness I go through the next step and soon after I closed the tab as it is asking for the components and that too in dropdown all the components are not there and then the library section it do not include all libraries
Please try think (use your brain) as alternative to pleasedontcode.com and chatgpt.
I have tested it.
Well it is a very good practising tool for writing detailed descriptions and for learning to really understand code
If you enter additional things for the functional description these functional descriptions are added as comments. And the code is expanded.
Though I think if a newcomer has added 3 or 4 additional descriptions the code becomes too large to be understandable for the newcomer and then the newcomer is totally lost between
the questions:
was my functional description precise enough that the generated code does what I want?
and
"what does the generated code really do?"
It is the same as with all automated services. They follow limited rules that can not cope adequate with the variaty of human language.
So the website should rename itself into
do-not-use___please-dont-code___learn-coding-YOURSELF
here is the generated code
/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
Pleasedontcode gives you this package free of charge and you
can use it for your personal projects. We will not be held liable for
any loss or damage of any kind. For all terms and conditions,
please visit pleasedontcode.com/termsandconditions
- Project: Testproject
- Source Code created on: 2023-07-05 17:29:26
- Source Code generated by: MeMySelfAndI
********* Pleasedontcode.com **********/
/********* User code review feedback **********
#### Feedback 1 ####
- add code that blinks the led
#### Feedback 2 ####
- use this function for non-blocking timing
// easy to use helper-
function for non-blocking timing
boolean TimePeriodIsOver (unsig
ned long &startOfPeriod, unsigned long TimePeriod) {
unsigned
long currentMillis = millis();
if ( currentMillis - startOfPe
riod >= TimePeriod ) {
// more time than
#### Feedback 3 ####
- limit the blink-interval to a mimium of 100 milliseconds and a m
aximum of 3000 milliseconds
#### Feedback 4 ####
- increasing blinkfrequency is based on button-press SEQUENCE shor
t press followed by a long press. Then after each 500 millisecon
ds of holding the button down increase blinkfrequency by 100 mil
liseconds
#### Feedback 5 ####
- detect a single short press or a double short press. If single s
hortpress is detected go into adjust-mode. in adjust-mode if but
ton is pressed down long after each 500 milliseconds increase bl
inkfrequency for 100 milliseconds
********* User code review feedback **********/
/****** DEFINITION OF LIBRARIES *****/
#include <Arduino.h>
#include <EasyButton.h>
/****** SYSTEM REQUIREMENT 1 *****/
/* Increase blink frequency if button is pressed once short and then pressed long */
/* Decrease blink frequency if button is pressed twice short and then pressed long */
/***** DEFINITION OF DIGITAL INPUT PINS *****/
#define myButton_PushButton_pushButton_PIN_D2 2
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
#define myLED_LED_Led_PIN_D3 3
// Create an instance of the EasyButton class
EasyButton myButton(myButton_PushButton_pushButton_PIN_D2);
// LED blink frequency variables
int blinkInterval = 1000; // Initial blink interval in milliseconds
bool ledState = LOW; // Initial LED state
// LED blink timer variables
unsigned long previousMillis = 0; // Stores the previous time value
// Adjust mode variables
bool adjustMode = false; // Flag to indicate adjust mode
unsigned long adjustModeStartMillis = 0; // Stores the start time of adjust mode
// Non-blocking timing function
boolean TimePeriodIsOver(unsigned long &startOfPeriod, unsigned long TimePeriod) {
unsigned long currentMillis = millis();
if (currentMillis - startOfPeriod >= TimePeriod) {
startOfPeriod = currentMillis; // Update the start time of the period
return true;
}
return false;
}
void setup() {
// put your setup code here, to run once:
pinMode(myButton_PushButton_pushButton_PIN_D2, INPUT_PULLUP);
pinMode(myLED_LED_Led_PIN_D3, OUTPUT);
// Initialize the button
myButton.begin();
}
void loop() {
// put your main code here, to run repeatedly:
// Read the button state
myButton.read();
// Check if the button was pressed
if (myButton.wasPressed()) {
// Enter adjust mode if not already in adjust mode
if (!adjustMode) {
adjustMode = true;
adjustModeStartMillis = millis();
}
// Exit adjust mode if already in adjust mode
else {
adjustMode = false;
}
}
// Check if the button was pressed for a long time
if (myButton.pressedFor(1000)) {
// Exit adjust mode if already in adjust mode
if (adjustMode) {
adjustMode = false;
}
// Increase the blink frequency
else {
blinkInterval += 100; // Increase the blink interval by 100 milliseconds
// Limit the blink interval to a maximum of 3000 milliseconds
if (blinkInterval > 3000) {
blinkInterval = 3000;
}
}
}
// Adjust mode logic
if (adjustMode) {
// Check if the button is pressed down long after each 500 milliseconds
if (TimePeriodIsOver(adjustModeStartMillis, 500) && myButton.isPressed()) {
blinkInterval += 100; // Increase the blink interval by 100 milliseconds
// Limit the blink interval to a maximum of 3000 milliseconds
if (blinkInterval > 3000) {
blinkInterval = 3000;
}
}
}
// Blink the LED based on the blink interval
if (TimePeriodIsOver(previousMillis, blinkInterval)) {
// Toggle the LED state
ledState = !ledState;
digitalWrite(myLED_LED_Led_PIN_D3, ledState);
}
}
@the moderators
keep this thread. It proves the recommended website as unuseful
best regards Stefan
An AI can code, but it takes a mind to program.
I disagree. The program posts a mishmash of what it has been trained on, by exposure to large numbers of examples scoured from web sites like the Arduino forum, Reddit and others.
Often, there are major errors in the mishmash, but if not, the minor ones can be hard to catch. In any case, you always get some sort of average of what a lot of other people have posted, some of it dead wrong, some of it very good.
The machine would be much more useful if people took the time to select only known, good code, and trained it using that database. Which is the general approach taken by the pros for commercial applications, like writing legal documents.
I think an AI could do a conversion, for example from a very verbose and accurate problem description or specification, to some language implementation. But the lack of self awareness of its own weaknesses prohibits a self review of its own work (which a human programmer is doing constantly). Thus it can only really make one pass, and the validity of the results can only be judged by the program behaviour (otherwise validation would be more trouble for a human than writing it themselves in the first place).
What I mean, it can code, given a perfect target specification. However I have to admit, the possibility of such a specification is doubtful.
Also, sadly, there isn't much good code around to select.
That's pretty much the definition of a compiler.
(But as @anon56112670 laughed about in #3, the 500ms toggle interval for "/* flashes the on board LED at a rate of 2 Hz */
" isn't an error of imperfect specification--it just plagiarized code it didn't understand.)
Which kind of components and libraries you are looking for?
#define myButton_PushButton_pushButton_PIN_D2 2
#define myLED_LED_Led_PIN_D3 3
I have the doubt in which pin the LED is connected and in which the button.
Are you the founder of this website ?
Yes, i am. I want to improve the ability of programmer freelance, sw engineers and entrepeneurs to speed up the finalization of their prototype projects and so reduce their costs and increase their profit.
So why didn't you just add that fact to your entry post?
Do you have a problem to identify yourself with your own work?
Just in case a reader isn't so curious about pressing on any link, why haven't you added some lines of why you suggest to use your tool?
What makes your tool outstanding?
Why do you consider it as an alternative to chatGPT?
It's an admirable goal, but automatic code generation is not new, and there is a reason why it's always been a niche product...
You ought to make your product work so that your examples are not laughable.