This is my first post. This is also my first attempt with ESP32 and I have come up against a problem. I have become intrigued with mecanum wheels and built the Mecanum Wheel Robot Car only to hit a problem at the attempt to run the 4wd test . I get a compilation error as follows.
"exit status"
"Compilation error; 'analogWrite' was not declared in this scope"
"analogWrite(MF_PWMA, speed_slow);" highlighted in the sketch.
I have tried all the Google help pages without success. I have the up-to-date version of windows 11 on my computer and have unblocked Arduino in the security system. Can anyone suggest a solution>
Hi @jrrobb,
Welcome to the forum!!
Sorry, I do not have an immediate solution, but perhaps I could suggest a way that might eventually lead to the desired outcome.
This particular topic area is meant for new members to say 'Hi', and maybe say a little about themselves .. which, you have done... so that is a good start!
Could, I suggest you now start a new thread in the topic area you think best fits your question, and provide more details. Ideally, imagine someone else is trying to reproduce your problem on their computer, but does not have your particular robot car, etc., so describe which IDE, and software you are using. In terms of software program, either include a listing of the code, or a reference to where it can be found if you downloaded it from a source on the web.
Best wishes and good luck, Dave
@jrrobb You can't google that. It's the equivalent of 'goodbye'. What it means is you have an error in your environment. I see this all the time, and it is always a struggle to help. Follow the instructions from ARDUINO, not from some social media or anyone else.
@davee If he can't resolve analogWrite, he has a fairly major problem.
@jrrobb Take a screenshot of your display showing what board and port is selected. Now start at the blink sketch and see what happens. Here is what you should see after you start the IDE and select the UNO board. Now select the blink sample and the port (NOTE I changed to the NANO board). Now I select the Sample Basics/Blink. Now I add an analogWrite statement, and by following the popup, help fill in the statement. NOTE I have NOT added any libraries so analogWSrite ZMUST BE builtin into the BOARD library. as can be seen by the successful compile in the last picture. Start at the beginning of the ARDUINO.cc website and spend a few weeks getting familiar with the correct procedure. If you can't replicate what I did then you are doing something wrong.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@jrrobb
Check your sketch for mismatched brackets. Probably "{}" but maybe "()".
Anything seems possible when you don't know what you're talking about.
It was a long shot, unbalanced brackets can convince the compiler that the code has already ended, so it doesn't think that some commands are still defined.
Check out Ron's post. The most likely cause is incorrect board selection or using an outdated board definition.
Good luck.
Anything seems possible when you don't know what you're talking about.
@jrrobb Very weird as analogWrite is built in to the board definition AFAIK, try changing the board to a generic ESP32. If you look at my previous reply you can see that I did the same as you and it worked other than I used a better-known ESP32.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@jrrobb Quick tip, close the left window by clicking the Library icon to free up some space. Now just type anywhere in the sketch exactly analog then tell me better still take a screen shot, the IDE should be giving you a list of all it's known 'things' that start with analog. See my pic
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@jrrobb Try this sketch, it compiles just fine;
```cpp void setup() { } void loop() { uint8_t pin = 2; int value = LOW; analogWrite(pin, value); } ```
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@jrrobb Jim, I just noticed you are using a cloud drive. I am not sure that works, and certainly is not good practice. Delete the Arduino directory but first copy any files you created if any somewhere safe and re-install the IDE onto your hard drive or SSD as the case may be.
I can also see an unusual depth to your source folders (see pic) that is not needed. Not a biggie, but having a DBWS folder under the Arduino folder makes sense, then under DBWS any of Bill's projects makes sense. Us programmers like to be well organized so I am just passing along my take on it.
After you delete and re-install be sure to let us know if all is now well.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Are you starting from Bill's version of the Macanum wheel car ? That is ...
Anything seems possible when you don't know what you're talking about.
@jrrobb Jim, It's really, really, really hard to help someone when they don't answer the questions we ask. Your issue can only happen if the installation didn't work correctly. I would NOT install the IDE to Onedrive, but I think the IDE install doesn't require a location in any case. HOWEVER, where you locate the Arduino folder is under your control, and it might be better to keep it local. I think with OneDrive you can later add the Arduino folder to be backed up in Windows, I don't see it in MacOS, though, I just did it a different way and now have 3 copies as a result. Here is a screenshot of how I have my Sketchbook location set up. You can do anything you want. My point is just to start it on your HDD, not in the cloud.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@zander Hi Ron, Sorry for the delay. I have reinstalled the IDE and here is a copy of a screenshot taken with the additional code you suggested.
@codecage has suggested that you move this discussion to a more appropriate forum and has created a convenient entry for you. Since he's an administrator, I'd strongly suggest that you move your future replies to that thread 🙂
BTW I've replied to this post in the other thread, see
Anything seems possible when you don't know what you're talking about.
@jrrobb Looks like there is a HUGE language barrier here and a lack of troubleshooting skills.
When troubleshooting, there are two common first steps: the divide and conquer approach and the second is to try a simple well-known piece of code and see what happens, often the infamous blink or 'hello world' sketches.
I was doing the latter, and the sketch I gave you was standalone, not to be added to your sketch. If it works for me but not you, where do you think the problem is?
I already answered that question with some things to try but maybe I assumed to much in the way of experience.
Try the following sketch with the UNO board selected and if it fails to compile, copy and paste the ENTIRE output screen so I can try to pinpoint your issue.
```cpp void setup(){ } void loop() { uint8_t pin = 2; int value = LOW; analogWrite(pin, value); } ```
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.