I am not even sure how to classify this issue

I honestly do not seem to be getting along very well with this whole Arduino thing. It seems every time I try something I am met with yet another issue. To be honest I really feel like I am going to have to step away for awhile.

Anyways, here is my new issue. I had been working on a sketch in the cloud IDE, which I so far like and have only found one annoyance but for the most part it has been working like a champ. I am using the Arduino-Create Agent on Linux and have been making progress..

Anyways, from within the cloud I downloaded my sketch temperature_warning, this downloaded as a .zip file which is not common on the linux/unix world, but whatever. I unzipped it using the unzip utility without error and was presented with a directory that contained 3 files.
Readme.adoc which is a slick pre-made layout to document your project. A sketch.json file and the temperature_warning.ino. The .ino file seems to be corrupted??

Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux

sketch.json in vim:

  1 {
  2   "cpu": {
  3     "fqbn": "arduino:megaavr:nona4809:mode=on",
  4     "name": "Arduino Nano Every",
  5     "type": "serial"
  6   },
  7   "secrets": [],
  8   "included_libs": []
  9 }

Interesting that under "included_libs"; it does not contain the <TH02_dev.h> library for the grove temperature sensor?

But here is the problem..
temperature_warning.ino in vim:

 1 /* Battery Temperature Warning System^M/* Written By Robert C^M/* Contributions from Arduino Community^M/* July 2021 */^M  ^M      ^M#include <TH02_dev.h>^M#include "Arduino.h"^M#include "Wire.h" ^M  ^M// Alarm Buzzer Function^Mvoid alarm_buzz(int count, int     ontime, int offtime)^M{^M  for (int x = 0; x <= count; x++){ ^M        digitalWrite(2, LOW); ^M        delay(ontime); ^M           digitalWrite(2, HIGH);^M        delay(offtime);^M  }^M}^M^Mvoid setup() {^M  Serial.begin(9600); // start serial for testing^M      delay(150);  // Power up delay 150ms^M  TH02.begin(); // Reset HP20x_dev^M  delay(100);^M  /* Determine TH02_dev is available     or not */^M  Serial.println("TH02_dev is available.\n"); // Temporary/Testing ^M  ^M  pinMode(3, OUTPUT); //ground control for     buzzer^M}^M^Mvoid loop() {^M  ^M  float temper = TH02.ReadTemperature(); ^M  Serial.println("Temperature: ");   ^M  Serial.pri    nt(temper);^M  Serial.println("C\r\n");^M  ^M  alarm_buzz(5, 1000, 1000); //Alarm 1^M  delay(5000);^M  alarm_buzz(8, 2000, 1000    ); //Alarm 2^M  delay(5000);^M  alarm_buzz(10, 500, 250);  //Alarm 3^M  delay(8000);^M}^M^M ^M^M ^M^M

Now I can go and open up the cloud, open up my program and manually copy and paste it into vim and overwite the corrupted file, but again it seems like more dickery doo. :sigh:

Anyways, any insight or if you need more information, I will be here waiting...

^M is the carriage return (AKA CR or \r).

Mac OS X used to use CR as the native line ending years ago. This meant that each of the common operating systems had their own style of line ending:

  • Linux: LF
  • Windows: CRLF
  • OS X: CR

Since then, macOS switched to using LF as the native line ending, leaving Windows as the odd man out, as is Microsoft's wont.

My preference is to always use LF, even on Windows. I suppose Arduino Web Editor could detect the user's operating system and convert the downloaded sketch to the native line endings, but it seems like not worth the effort. Either way, the use of CR line endings when someone is downloading on Linux is never right (and wouldn't even really be correct on modern macOS). I also confirmed this happens on Windows.

You can convert the line endings easily enough, but certainly you shouldn't be expected to do so.

Since this is about Arduino Web Editor, and not at all specific to Arduino CLI, I've moved it to the appropriate forum category where the Arduino Cloud folks will see it.

Pert,

Thank you for your continued patience with my seemingly unending issues.

Although I was able to get Arduino syntax highlighting in vim, so there is a small win!

Here is my corrected, un-corrupted code in vim. Although the syntax highlighting does not show here, it is quite beautiful :smiley:

  1 /* Battery Temperature Warning System
  2 * Written By Robert C
  3 * Contributions from Arduino Community
  4 * July 2021 */
  5 
  6 
  7 #include <TH02_dev.h>
  8 #include "Arduino.h"
  9 #include "Wire.h"
 10 
 11 // Alarm Buzzer Function
 12 void alarm_buzz(int count, int ontime, int offtime)
 13 {
 14   for (int x = 0; x <= count; x++){
 15           digitalWrite(2, LOW);
 16           delay(ontime);
 17           digitalWrite(2, HIGH);
 18           delay(offtime);
 19   }
 20 }
 21 
 22 void setup() {
 23   Serial.begin(9600); // start serial for testing
 24   delay(150);  // Power up delay 150ms
 25   TH02.begin(); // Reset HP20x_dev
 26   delay(100);
 27   /* Determine TH02_dev is available or not */
 28   Serial.println("TH02_dev is available.\n"); // Temporary/Testing 
 29 
 30   pinMode(3, OUTPUT); //ground control for buzzer
 31 }
 32 
 33 void loop() {
 34 
 35   float temper = TH02.ReadTemperature();
 36   Serial.println("Temperature: ");
 37   Serial.print(temper);
 38   Serial.println("C\r\n");
 39 
 40   alarm_buzz(5, 1000, 1000); //Alarm 1
 41   delay(5000);
 42   alarm_buzz(8, 2000, 1000); //Alarm 2
 43   delay(5000);
 44   alarm_buzz(10, 500, 250);  //Alarm 3
 45   delay(8000);
 46 }
 47 

If you go beyond using a browser or a texteditor
Linux is still a nerd's operating system.

I bet you googled a lot for all those sudo-tutorials to get things up and running.
I don't like Microsoft and windows but from a "how does it work?" point of view
running a Windows 10 machine installing the local Arduino IDE for windows I never had such problems.

best regards Stefan

Haha, Linux has grown far beyond a nerd's operating system, but I will agree that it takes a special kind of nut to run Linux.

And you are correct in that just submitting, run windows and install the latest arduino ide and call it a day. But for some of us its about not the ease of things, its about challenging ourselves to a higher degree of understanding. (and albeit, frustration)

In addition to Linux I also go by the 24hr time format, I have for decades. Why? its quite simple...there are 24 hours in a day, not 2 separate 12 hour cycles. Which leads me to the final straw with windows 10, when it would load I noticed that it would initially display the standard time and then change to 24hr format. So your telling me that this OS cannot even operate and display the 24hr time format, it literally has to do a conversion and not only that, it does the conversion after it initiates and displays standard time. Time is such a basic function of a computer OS and yet here we are all these years later and it still has to do a conversion for something as basic as time.

Keep in mind I upgraded from DOS 5 to DOS 6.22 using dual floppy drives on my IBM PC AT with 128kb of ram, no hard drive mind you. At the time a 10mb hard drive was well over $1,000!

My first version of Windows was Win3.11 for workgroups that my buddy scored from his mom who worked at a university in the early 90's

I have used the following O/S's over the course of my life:
DOS, Windows 3.x, 95, 98, Xp, 7, and 10, Linux over the course of the last 20 years, FreeBSD, first install was version 4.4, last year I challenged myself to install BSD 12 from a minimum cli install from source binaries and get it all up and running with wifi and Xfce desktop, success, I have also used IBM AS400, Novel Netwear, and Solaris.

So this isn't just about using Linux because I am a nerd, its about demanding my O/S to more then just look pretty, its about functionality, durability and security. And above all its about choice.

Would I just install windows and the IDE just for the sake of using Arduino? NO I would not.

I would rather learn C and C++ and learn how to work with embedded microcontrollers from the bare metal perspective. Some times the long road is a harder journey but the reward is much greater and the victories much sweeter.

I never had such problems.

You also can never say your in control if you have never been out of control :wink:

Cheers,
Robert

You're welcome. I'm glad if I can be of assistance.

Way cool! Is it something Arduino-specific, or a general purpose C++ syntax highlighting configuration?

That is not really a fair comparison though. @ramjeepee is integrating Arduino CLI with Vim. I'm certain this would be just as complex, if not more, to do on Windows.

I think that getting started using Arduino IDE on Linux is fairly straightforward. The Linux installation script does seem to give people trouble more often than the Arduino IDE's installer does. I never bother with the installer and just run the IDE directly on both operating systems and it works just as well on both.

The need to configure udev rules on Linux for the Arduino board's port in order to do uploads is definitely not a great experience. The Windows equivalent hassle is installing drivers, but that's usually only necessary when using one of the less well supported USB chips like the CH340.

Same here. Our time system is convoluted enough already without throwing AM/PM in the mix.

I use Windows as my primary OS because the majority of the users use Windows. I am more effective at providing support and doing beta testing when I use the same operating system as the users. This becomes even more important when you take into consideration that most developers do not use Windows as their primary OS. So the most prevalent operating system is also the least thoroughly tested!

If not for that, I would be using Linux. And I do use Linux directly almost every day (and of course we all use it indirectly).

Here is a snipped from the main syntax file. It sure would be pretty nice if Arduino had official files like these to integrate with vim/emacs etc...

Arduino\lib\keywords.txt{{{
	syn keyword arduinoConstant HIGH LOW INPUT INPUT_PULLUP INPUT_PULLDOWN OUTPUT DEC BIN HEX OCT PI
	syn keyword arduinoConstant HALF_PI TWO_PI LSBFIRST MSBFIRST CHANGE FALLING RISING DEFAULT EXTERNAL INTERNAL
	syn keyword arduinoConstant INTERNAL1V1 INTERNAL2V56
	syn keyword arduinoType boolean break byte case char class const continue default do
	syn keyword arduinoType double else false float for if int long new null
	syn keyword arduinoType private protected public register return short signed static String switch
	syn keyword arduinoType this throw try true unsigned void while word boolean byte
	syn keyword arduinoType char float int long word
	syn keyword arduinoFunc abs acos asin atan atan2 ceil constrain cos degrees exp
	syn keyword arduinoFunc floor log map max min radians random randomSeed round sin
	syn keyword arduinoFunc sq sqrt tan pow bitRead bitWrite bitSet bitClear bit highByte
	syn keyword arduinoFunc lowByte analogReference analogRead analogWrite attachInterrupt detachInterrupt delay delayMicroseconds digitalWrite digitalRead

Since you recognize this, (and most windows end users do not) perhaps more effort and time should be spent in this area of development. If you can attract more professional developers, then perhaps you start to establish Arduino not just as hobby maker market tool, but a full fledged professional grade development platform.

Really? That doesn't seem like a very positive and progressive attitude toward your own product?

Your admitting it is a problem yet you say it seems like its not worth the effort. You also recognize that most developers don't use windows, so when they use your product and have to go through all these little annoyances that could be fixed, Arduino is basically saying 'Nah, not worth it'.

Kind of baffled at that attitude??

Anyways, I am going to call this thread done, feel free to close it up if you like.

Robert

Which area of development is that?

I apologize that I didn't communicate clearly in my previous reply. As I said from the start, the use of CR line endings in the downloaded sketch is wrong. This is a bug that should be fixed. It is very much worth the effort to fix that bug.

My "it seems like not worth the effort" was about detecting the user's operating system and providing their native line endings. The native line ending on both Linux and macOS is LF. So this means the need for OS-specific line endings is only to provide CRLF for Windows. But I have never once seen a problem on Windows caused by files with LF line endings. So it doesn't seem worth the effort to set up a system to provide CRLF line endings in the downloaded sketch for Windows when there is no benefit to those line endings. My proposal is that it should be changed so that the downloaded sketch always has LF line endings.

I'm also kind of baffled by the negative turn this this conversation took. I thought we were having a nice discussion.

My sincere apologies, I suppose I woke up on the wrong side of the bed this morning. Everything is good, and again I sincerely appreciate all the assistance you have given me, your an A+ guy in my book.

Sorry if I got snappy :worried:

Robert

Hi @ramjeepee. I have some good news. The Arduino Cloud developers have now made the switch to the use of the standard LF line endings in all sketch files.

Thanks for reporting this. Please let us know if you spot any problems.

Regards, Per

1 Like