UKHeliBob:
Are they actually on the pin or are they floating ?
Maybe I need PULLUPs ? (or PULLDOWNs ?)
...R
UKHeliBob:
Are they actually on the pin or are they floating ?
Maybe I need PULLUPs ? (or PULLDOWNs ?)
...R
Heh...I hope I came across as half-serious in this thread. I'll call them "string" and "String" if that's how things are in Arduinoland...
I sort of had this Arduino stuff thrust upon me, however. Usually when I switch to a new embedded system I just have to read a micro datasheet and a compiler manual.
With Arduino you have this whole layer on top of that...
BigBobby:
<...>
With Arduino you have this whole layer on top of that...
Yes. The noise responses are just routine forum static.
Arduino is IMO a two-layer extra: the Arduino "language" abstractions and the hardware abstractions known as the "core". Even early 8-bit AVR arduinos were somewhat different; for example one hardware serial device in Uno to three in the Mega2560, etc. Also, some uC boards such as the Leonardo were native USB and capable of multiple USB profiles.
The above hardware variances simply mandate that you have a small collection of board/uC printouts to be able to mentally contemplate the resource.
Unlike soft microcontrollers such as the Cypress PSoC line which has extensive internal switched fabric mapped by VHDL, the Arduino pinout and circuit layout are rather limited in flexibility.
But, the core concept can lead to many development boards that are somewhat restricted in tools to have a second life un Arduino land: example STM32F103 which was used in the Maple series and now a very complete $4 arduino: http://www.stm32duino.com
Ray
mrburnette:
Arduino is IMO a two-layer extra: the Arduino "language" abstractions and the hardware abstractions known as the "core".
Hmm...interesting point about the two layers.
I have yet to use any Arduinos other than the Uno, where the hardware abstractions have been a bit of an annoyance (I was so thrilled the first time I tried to use an I/O, and discovered that the proper way to do it was to use special names that the Arduino had assigned as opposed to what's in the datasheet). In order to make the same code work on different Arduinos, however, that is what they needed to do.
BigBobby:
<...>
In order to make the same code work on different Arduinos, however, that is what they needed to do.
In the beginning, I agree. I think now, the focus is to use the same IDE because Arduino IDE use is widespread; even if the Arduino "core" forces inefficiencies; that is, the IDE and wide selection of libraries often outweigh performance. If you doubt this, just take a look at any Adafruit library and note the numerous #ifdef statements sprinkled throughout thecode in order to support various manufacturer's hardware (models.)
// https://github.com/somhi/ESP_SSD1306
#ifdef __AVR__
#include <avr/pgmspace.h>
#elif defined ESP8266 //Added for compatibility with ESP8266 BOARD
#else
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif
Other libraries are for more complex.
Ray
BigBobby:
the hardware abstractions have been a bit of an annoyance
If you're into Object-Oriented solutions, you should check out Cosa. It has the best HW abstraction I've ever seen. If you think C++/OO cannot be efficient, you'll be very surprised, especially if you look at the generated assembly. It's much faster than any "native" Arduino core libs. Cosa's SPI and UART performance is unbeaten, I believe. Zippy, yet very readable.
Cosa is really an alternative "framework" or "core". Many boards and devices have been integrated by the author, so they are very consistent in style, unlike the hodge-podge you get with Arduino libraries from different authors (with different skill levels, I might add). Be sure to see the Doxygen-generated online docs here.
Cosa apps can still be built with the Arduino IDE by selecting a different "Board" (e.g. Cosa UNO instead of Arduino UNO). It also offers a slick makefile system, leaving the IDE waaay behind.
Cheers,
/dev
BigBobby:
I'll call them "string" and "String" if that's how things are in Arduinoland.......SNIP....
With Arduino you have this whole layer on top of that...
The confusing usage of String and string that you are complaining about is NOT an Arduino issue - it is a C/C++ issue.
Heh...I hope I came across as half-serious in this thread.
You may be serious but I can't see how your interventions have been any assistance to the OP.
...R
Robin2:
The confusing usage ofStringandstringthat you are complaining about is NOT an Arduino issue - it is a C/C++ issue.
You may be serious but I can't see how your interventions have been any assistance to the OP....R
Haha...I guess this is the forum static that was mentioned before?
Not only isn't it a C/C++ issue, but I provided a link to the standard to prove it. Did you not read it, or did you not understand it? If it's the latter, I can explain it to you but how the hell can you have 24,515 posts and not know this stuff?
And my first post is quite easily the most helpful thing for the OP in this thread.
Seriously...read a book. This isn't the first time I've seen you blathering on about something where you had no idea what you were talking about.
my first post is quite easily the most helpful thing for the OP in this thread.
In your first post you said
You're mixing up "Strings" with "String Objects"
I find it somewhat amusing that the link you provided to explain Strings (uppercase) leads to a page headed strings (lowercase)
UKHeliBob:
In your first post you saidI find it somewhat amusing that the link you provided to explain Strings (uppercase) leads to a page headed strings (lowercase)
Ffs...when I added the links the full URL was cumbersome as the displayed text so I snipped it to the last word. Go type "Arduino string" into google. The first link you get is "https://www.arduino.cc/en/Reference/String" and the second you get is "https://www.arduino.cc/en/Reference/StringObject." The OP left here happy with my answer and a general awareness that String objects are inefficient.
And double ffs...you must realize that the Arduino has a respect problem in real engineering environments. While there are some people on these forums that seem to know what they're doing, your persistance with the trivial "string" vs "String" thing (and being unaware it isn't a C++ thing) contributes to that lack of respect.
I am afraid that however you refer to them, Strings, String objects, strings, C style strings or whatever there is always going to be confusion because they use the same word.
Good luck with your campaign to educate people to use the right terms to refer to the right type of Strings but you are not going to get very far I think because by the time that people ask questions they have usually used String objects which are frowned upon here for a variety of reasons including bugs in previous versions of the Arduino IDE/compiler/preprocessor (I know not which)
Personally I still think that using string and String to refer to the two different methods of doing things is still valid in this forum but it does deserve an explanation of the difference when the terms are introduced. I would suggest a sticky or a "Useful thread" explaining the difference but as many people don't appear to read any of the stickies and persist in posting code snippets not in code tags I don't think that will work.
I suspect that we will have to agree to differ on this.
UKHeliBob:
Good luck with your campaign to educate people to use the right terms to refer to the right type of Strings
You must be kidding. I was done with the thread in the minutes it took to satisfy the OP. You and your pal are the ones that have spent days chastising me for my capitalization.
And pretty much anyone with a good understanding of C/C++ is not going to assume that the Arduino has this convention for its String class. Now that I'm aware of the convention, I agreed to use it (several posts ago).
If nothing else, hopefully this waste of bandwidth taught your pal something about C++. Hopefully it also taught him to not be arrogant when "correcting" people. When you do that and you're right, you look like a jerk. When you do that and you're wrong, you look ridiculous.
mrburnette:
boolean LED_Read(void) {
return ~true;
}
I just wanted to point out that ~true is the same as true (though it doesn't really make sense to bitwise complement a boolean value). If you want a false value, say "!true" or simply "false".
It's too bad Arduino doesn't use Java. The solution to this problem, for example, if your delimiter were a semi-colon would be this simple:
String[] items = serialString.split(";");
and WALLA! Instant array populated with each piece of the string between delimiters.
EasyGoing1:
It's too bad Arduino doesn't use Java.
Heaven protect us.
It's bad enough that it uses C/C++
...R
Robin2:
Heaven protect us.It's bad enough that it uses C/C++
...R
I agree. It would be so much better if it were programmed in MUMPS (Yes, it is a real programming language) ![]()
I remember hearing of MUMPS but I can't remember anything else about it. I am inclined to associate it with COBOL for some reason.
...R
As you might have gathered I wasn't entirely serious about programming an Arduino in MUMPS. It has none of the nonsense of needing to declare variables before using them, all variables are globals, there are no data types and the program and database it uses are one and the same thing. It does, however, have an excellent method for splitting delimited data !
UKHeliBob:
As you might have gathered I wasn't entirely serious about programming an Arduino in MUMPS. It has none of the nonsense of needing to declare variables before using them, all variables are globals, there are no data types
Ah ... someone, back in the day, who could not spell BASIC then ![]()
...R
Another way
void setup() {
Serial.begin(9600);
}
void loop() {
String data="$GPGGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh";
int maxIndex = data.length() - 1;
int index=0;
int next_index;
String data_word;
do{
next_index=data.indexOf(',',index);
data_word=data.substring(index, next_index);
Serial.print("Output line: ");
Serial.println(data_word);
index=next_index+1;
}while((next_index!=-1)&&(next_index<maxIndex));
}
Outputs:
Output line: $GPGGA
Output line: hhmmss.ss
Output line: llll.ll
Output line: a
Output line: yyyyy.yy
Output line: a
Output line: x
Output line: xx
Output line: x.x
Output line: x.x
Output line: M
Output line: x.x
Output line: M
Output line: x.x
Output line: xxxx*hh