Pages: 1 [2] 3   Go Down
Author Topic: New arduino language  (Read 4888 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 525
Posts: 26554
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am doing a design now with the 1284P, starting with a deumilanove layout, keeping the shields, and expanding the board size some for some custom IO and a memory card. Seems like a nice chip.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London, GB
Offline Offline
Sr. Member
****
Karma: 8
Posts: 332
Nothing works.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If I may add a point to the original motive.

I’ve tried Bitlash, and Transterpreter, and they both promise to work, and probably do. However, they fall down considerably because there isn’t a wide enough range of examples from which to patch together one’s own programs with. It’s almost as though one is expected to actually learn the language, as the first step.

The conventional Arduino language has a vast amount of examples, which is a good thing (even if the language itself is unusably bad and unintuitive). Of course, most people stop using it when they find that the examples are not able to be easily combined in any useful way without errors or requiring actually learning the language at such an inappropriately early stage of usage and familiarisation.

My recommendation, therefore, is to start with a wide range of examples of pretty much everything that is possible, and design it such that they can all be combined, in any permutation that a person would imagine useful. Then design the language around that framework, so that the user doesn’t have to actually see any of it.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8475
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The 1284 has to be the best overall chip in the AVR lineup I think, 2x the 2560 RAM, one extra UART which is all most need, gobs of flash and IO.

I'm using it on two boards about to go to PCB fab.

______
Rob
 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2066
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@crossroads and greynomad: my recommendation for an arduino for the second decade of this century is to put a sdcard (micro) and an external RTC chip with a coin battery (cr1220 is enough) on the board. The rtc e.g. pcf8563t - very cheap and lowest power consumption (200nA), or ds1307.
1284p + sdcard + ext_rtc gives you a very good base for the future projects. In the moment as you start with sdcard as the storage for data, scripts, sketches, firmware backups etc. you have to have a source of _actual_ time, anytime, even you switch off the main power. And maybe as an option a 32khz watch crystal at timer2 for low power operation (not for rtc).
As the language is concerned - I am a little in doubt whether there is something better than C/C++ supported with good libraries and good approach to the overall concept. Maybe to design a better mechanism for writing modular libraries _fully_independent_ on the actual cpu_hw_resources_assignment would be a good first step. Maybe a GUI where you take modules/methods/libraries and edit&reconnects them with a few clicks. An RTOS would be a nice to have feature on arduino, but mind the drivers are the biggest trouble with a practical rtos - they need to be rewritten. General acceptance of forth is low today and there is an issue with ready libraries availabilty (almost none..). So for such cpus as the atmegas are (with limited resources) the C is the most feasible choice, however for the arduino users with a good code generation automation.
Logged

London, GB
Offline Offline
Sr. Member
****
Karma: 8
Posts: 332
Nothing works.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But all I ever see with C is errors, nothing actually works, so it’s the least appropriate language.

There must be a relatively restricted range of things you can want to do with an arduino. Stop forcing people to write it in ‘code’ in case someone intercepts the message and decodes it and all the plans are foiled. Just let people write actions that work. The blink sketch should be a single word, being such a common task. Most of the tasks that people put the arduino to are not wholly unique, they’re in common with what other people have also done at some time. The words to make it do that should be as simple as possible.

Plenty of people want to write information to an LCD. Plenty of people want to read temperature from various devices. Plenty of people want to make RGB leds change colour. Plenty of people want to control motors. Plenty of people want to read pots and adjust servos. Plenty of people want to read switches and turn relays on and actuate optoisolators and measure light and read accelerometers and so on. Very rarely would someone want to do any of these in a way that totally and fundamentally differs from the way everyone else is. In most cases, they’d be glad to adopt best practice. This should all be made simpler. Just present a framework that offers all the common possibilities of arduino use instead of having to write this ridiculous ‘code’ over and over again, which hardly ever works.

After all, it’s not as though each person using an arduino is having to invent the wheel all over again from scratch, and it’s not as if the arduino offers unlimited or limitless possibilities and therefore requires as flexible and efficient as possible a language to control it. Most stuff is the same as most other people’s stuff, most of the time. The common use cases cover almost all of what most people want to do with it in the first few years of their experience. Anything outside of those use cases can be programmed with custom ‘code’. The bulk, however, might as well be encapsulated into a very predictable and very efficient to use framework — one that doesn’t frustrate or infuriate or deter.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8475
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And maybe as an option a 32khz watch crystal at timer2 for low power operation (not for rtc).
Many RTCs (the DS323x for example) have a 32kHz output, this could be run to a spare interrupt and used as the time base for millis(), that way there's no missing numbers and it's dead accurate. It also frees up a hardware timer.

Quote
But all I ever see with C is errors, nothing actually works,
That's true when you start with C (and for quite a long time afterwards as well smiley) and I'm sure it's put off many a potential programmer. But at the end of the day C is probably the best language for most embedded applications.

Now Arduino was I think originally aimed at artists etc so you could validly argue that in that regard C is not a good choice. But when the "artist" decides to do something complex that sends waves of light through a 1000 LEDs an interpreted BASIC won't cut it.

What's the answer? Buggered if I know. Arduino goes half way with it's HAL, maybe an even higher level of abstraction is called for, for example Ian mentioned that you shouldn't need a whole program to flash a single LED. This can be fixed with a little bit of scheduling in the background and a function like

flashLED (pin, onTime, offTime);

So I think for the beginner maybe this stuff could be built in, no finding libraries or downloading classes from git.

This (as does the current system) still allows advanced users to write "native" code that dicks with registers etc and also allows someone to gradually change over from a warm and fuzzy protected environment to working with the bare metal.

______
Rob
« Last Edit: May 02, 2011, 03:42:30 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

London, GB
Offline Offline
Sr. Member
****
Karma: 8
Posts: 332
Nothing works.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Absolutely.

And it’s not just flashing a led. I wouldn’t be surprised to discover that among most arduino users, most people’s programs consist of selections from the same archetypal 20 (or 40, or 100, or make up some other number here) quite narrowly implemented actions, over and over and over again. It’s probably a small clustered figure such as the numbers I just tossed into the previous sentence, rather than an infinite horizon of totally different and unrelated programs on each arduino out there.

I suspect there to be a surprisingly minimal amount of times that any given implementation requires significant excursions into the unknown, never-been-done-before and wholly unique. Rather, most of what you’d want to do strongly resembles what other people have already done, given the hardware that people commonly hook up to the arduino, and given the relatively defined permutations and combinations of such arrangements. If only there were a list of “things you’ve had your Arduino do” that could break down into a statistical view of handfuls of common tasks per implementation, it’d be quite revealing.

You could almost pre-write the 4-bit LCD handler, the one-wire temp handler, the push-button handler, the RTC handler, etc to the degree that creating a digital clock that displays the time and temp could be a series of about four or five easily understandable words. I’d proffer that you could push this to an extreme, suggesting that the requirements about 90% of what most people posting on this forum could be catered for in this kind of regime if it were available as a choice.
« Last Edit: May 02, 2011, 02:36:08 am by Ian Tindale » Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2066
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

..the arduino is C-based, and it has not been rejected by artists yet..
However, the artists are creative people so they may require a new functionality while maintaining the responsivness (execution speed). The greatest added value of arduino stuff for people (even experts) is the availability of ready libraries you simply take and include in your code for various arduino platforms or bare metal as the arduino is basically a bare metal. So what would be interesting to have is a tool which will create a library for a specific functionality in an user friendly manner. A "compiler" from a simple to understand, descriptive language to a library or directly to a sketch. However, the library/sketch shall be C as is today (small code, fast, a standard).
E.g.  smiley-cool :

: creazy_blinking
blink pattern1 (led1 on for 1000ms, led2 on after led1 is off for 3000ms)
blink pattern2 repeat (led3 on for 50ms, led6 on after led is on for 200ms, led8 100 blinks with 300ms period)
;

save creazy_blinking into external eeprom
save creazy_blinking into sdcard


: run_pattern2
on May-3-2011 when analog3 is bigger than 300 load from sdcard pattern2 from creazy_blinking and run pattern2 till May-13-2012
;

The result shall remain in arduino C. Good luck!
Logged

Ireland
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But all I ever see with C is errors, nothing actually works, so it’s the least appropriate language.

With respect, that's a strange thing to say. If "nothing actually worked", the Arduino would be a completely useless platform. It's not, so clearly someone is getting programs to run without error.

If there's a demand for a higher-level language than C, I'm sure it will emerge. I'm not convinced it's needed. C isn't a particularly simple or intuitive language, but it's very possible to learn, and people can and do learn it.
Quote
There must be a relatively restricted range of things you can want to do with an arduino.

Hell, no. The beauty of a platform like Ardiuno is that there's almost no restriction on what you can do with it.

I have no issue with the idea of a higher-level, easier-to-learn language, but I'd hate to see it replace C for those of us who want access to the full power of what the AVR can do and don't need our hands held.

It's worth checking out Google's App Inventor for Android, which has a lot in common with StarLogo TNG - a visual style of literally assembling programs from basic building blocks. The challenge is to produce something similar which can produce tightly-optimised machine code. It would be a neat way to ease people into programming the Arduino, but it would drive me crackers if it was the only way to do so.
Logged

London, GB
Offline Offline
Sr. Member
****
Karma: 8
Posts: 332
Nothing works.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

… I'd hate to see it replace C …

… it would drive me crackers if it was the only way to do so.

Cite a reference to where anybody, anywhere in the world, at any time in history, said anything remotely resembling that.
Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 32
Posts: 1206
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IMHO (or not so humble smiley-wink )

There will never be a language for all needs - not even on the Arduino. SO, each to its own, or perhaps limited to a few categories. Further, the ATmel chip can only do the same instructions, so it is a red herring to discuss what the language can/can not do, it is just a matter of more or less tedious programming. (In theory I could write an Atmel emulator in BASIC....)

I do not have children in the toy age anymore, so I do not own a Lego MindStorm kit, where I am told the controller can do some nifty things and the programming interface is limited (graphic) but easy enough for anybody. Yes, I've seen YouTube videos of long and complex programs (f.ex a HUGE machine build out of Lego builds a small Lego model) So I am sorry if I am speaking a bit without having all the facts, but I'd say that is one example of a possible "simple" language.

IanTindale mentioned it briefly earlier on in this thread, the link is to Transterpreter/Plumbing which also is along those lines, but here nicely setup for parallel programming.

Then there is C occuping the middle ground. And C++ for slightly higher up (classes and that).  So far I have not had any speed problems with coding in C. And I like the abstraction layer the Arduino core gives me (Fuses, Timers and sundry housekeeping) Hey, there even is interrupt programmng possible! (which is almost assembly language, you have to worry about voletile, possible reentrancy and suchlike)

For the dedicated developer, the most demanding programs, we can go to down to assembly as the AVR groups do. I have not tried that myself, although I used to do assembly language for microprocessors about 3 decades ago. Been there, done that, not again smiley . At this level all the nitty gritty of the Atmel chips is exposed, too - registers, processor differences, addressing architecture, timing and race conditions.

Irrespective of the language, there is the hardware abstraction. The core library already do a lot of that digitalWrite(), servo.write(), millis(). Usually the abstraction is tied to the language, by way of the API. They tend to / should match in the level of abstraction.

If we "dumb down" the language, what about the electronics? That needs to be dumbed down, too. To paraphrase an earlier argument in this thread - All I see is people not being able to connect up a transistor to drive a motor, clearly we need motors that run directly off the Arduino. I have seen some experimenters kit (f.ex. Tinker Kit) where everything is mounted on boards and has a 3wire connection (cant be plugged in wrong) so power/control is taken care of.

So, I think the question of a new language should perhaps be more along the lines - do we need two or three levels of Arduino : BuildingBlocks, ProgrammableElectronics and BareMetalHardCore and what should they allow/limit/guide/enhance/abstract ... ? ?
Logged

London, GB
Offline Offline
Sr. Member
****
Karma: 8
Posts: 332
Nothing works.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
There must be a relatively restricted range of things you can want to do with an arduino.

Hell, no. The beauty of a platform like Ardiuno is that there's almost no restriction on what you can do with it.

That sounds like utter nonsense to me. Most of the stuff that people do with their arduinos, assuming they get as far as doing something with it, is the same sort of stuff that other people do with it. The really diverse, unique and novel uses are rare and certainly in the minority — it almost counts as noise. What people actually end up doing with it can fit into a not very wide set of quite commonly defined use cases. To say there’s almost no restriction on what you can do with it has nothing to do with what people actually end up doing with it in reality.
Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 32
Posts: 1206
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
There must be a relatively restricted range of things you can want to do with an arduino.
Hell, no. The beauty of a platform like Ardiuno is that there's almost no restriction on what you can do with it.
That sounds like utter nonsense to me.
Yes and no, it depends how exact we talk about. The Arduino can only send a few digital signals. And sense a few, possibly analog. So that is all it does, every one does that.

No, next level of "abstraction": People build LED cubes/signs, or simple robotarms, or do temperature control. Yes, a few simple cases.

This is "multiplied" by the "how" : Some temperature control is just on the breadboard because it is fun. Some use it for the aquarium, beer brewing, or keeping the chicken coop with daytime synchronised variation. Some is a thrown together circuit, others do it with care and polish.

Each of these is mutiplied by the "why": Some just want to play, some have a problem to solve, some see the way they learned how to get it to work the satisfying part, some are totally uninterested in the Arduino, they just have an end product.

Lastly the spread of differnet users: Some are artists (not known for logical/mechanical understanding), or engineers that get to physically do what they only get to design at work, or school kids, or programmers that are tired of only seeing the fruits of their labour on a screen and finally see some real life object move&flash instead.

I consider all of these examples of the great variation which the Arduino platform enables. Enables, not solve.
Logged

London, GB
Offline Offline
Sr. Member
****
Karma: 8
Posts: 332
Nothing works.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then you’re wrong, apart from the first stage. The rest of what you mentioned is just rhetorical waffle.

If we stick to the first stage, where people build led cube after led cube after led cube, or attach LCDs, or read temperatures, drive motors, switch relays, etc, these are not unique. Other people have done all these. There’s surely best practice, by now, that can be encapsulated in a framework that allows people to bypass the tedious and repulsive programming hell a bit more than they can now.

How you use the implementation of that framework can be expressed along the lines of your latter flowery advertisement prose.
Logged

Ireland
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
There must be a relatively restricted range of things you can want to do with an arduino.

Hell, no. The beauty of a platform like Ardiuno is that there's almost no restriction on what you can do with it.

That sounds like utter nonsense to me.
That's only fair, because your assertion that C programs don't work sounded like utter nonsense to me.
Quote
Most of the stuff that people do with their arduinos, assuming they get as far as doing something with it, is the same sort of stuff that other people do with it. The really diverse, unique and novel uses are rare and certainly in the minority — it almost counts as noise. What people actually end up doing with it can fit into a not very wide set of quite commonly defined use cases. To say there’s almost no restriction on what you can do with it has nothing to do with what people actually end up doing with it in reality.
I don't care what most people do with it, and I don't care what you consider noise. I have some applications planned for the Arduino that may be diverse, unique and novel - or they may not - but I know that I can implement them in C. I got my first Arduino a few days ago, ran the first three example sketches, got bored with them, wired up a bunch of LEDs and a potentiometer and wrote a sketch from scratch to manipulate them. It worked first time without debugging.

The reason for this is that I learned C. I learned it a long time ago; it was about the third programming language I learned. I haven't written a C program in maybe 20 years, preferring to use Python these days, but it wasn't hard to learn back then and it's not that hard to learn now.

You seem antagonistic to the idea that someone should actually have to learn a programming language to write a program. That's something I find hard to fathom; it's akin to arguing that it should be possible to incorporate an Arduino into an electronic project without understanding electronics. The project I'm working on now required that I learn quite a lot more about electronics than I previously knew. I learned it. It's not rocket science.
Logged

Pages: 1 [2] 3   Go Up
Jump to: