eluino and constrain function

classic Classic list List threaded Threaded
6 messages Options
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

eluino and constrain function

Hello people!,

some few days ago, I've started writing an Arduino like interface to eLua, called eluino. Before you start throwing rocks, I got a reason.
Some of my friends use Arduino to build their projects and are not used to program in Lua, then I thought to myself that I could build a set o functions
to help them to start with eLua.

For now, I got a small set of function, not including analog functions:

I have tested in my MBed and Mizar32 and worked fine. After starting mapping, I found the function constrain, from Arduino, but I didn't find it in eLua. I know
it's a easy function to implement, so I decided to put on Lua, adding directly to lmath.c, but I think it's not the right place to put it.
The commit is there:

I hope it will be useful for someone out there... suggestions are welcome!

Cheers,
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eluino and constrain function

No opinions? :p

2013/3/7 Gabriel Duarte <[hidden email]>
Hello people!,

some few days ago, I've started writing an Arduino like interface to eLua, called eluino. Before you start throwing rocks, I got a reason.
Some of my friends use Arduino to build their projects and are not used to program in Lua, then I thought to myself that I could build a set o functions
to help them to start with eLua.

For now, I got a small set of function, not including analog functions:

I have tested in my MBed and Mizar32 and worked fine. After starting mapping, I found the function constrain, from Arduino, but I didn't find it in eLua. I know
it's a easy function to implement, so I decided to put on Lua, adding directly to lmath.c, but I think it's not the right place to put it.
The commit is there:

I hope it will be useful for someone out there... suggestions are welcome!

Cheers,
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/



--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: eluino and constrain function

Hello Gabriel and good morning. It is 7:30a.m. here.

I think that one of eLua's aims is to be small in code and memory use,
so mainline avoids adding features that are not necessary in the core.

For your project, you could implement that function in Lua, in an
include file (oops, sorry, a "require" file) and in less code.

In general, when people only know one language and then meet a second
one, they usually try to program in the first language using the
second by #defining the second to look like the first, simply because
the first language forms your way of thinking about computer
programming, and provides your first vocabulary for programming
concepts.
I think the classic example is the original Bourne Shell, which was
written in C #defined to look like ALGOL, complete with IF THEN ELSE
ENDIF macros.

It's good as a personal programming exercise to help you understand
the correspondences between the two languages, but if you write real
programs in your new dialect, you isolate yourself from the community
that already speaks the second language.

Not that I like eLua's libraries - I would have implemented luaposix,
luasockets, luafs and their friends, specifically to unite with the
existing community and to be able to use hundreds of standard
libraries, but at least everyone understands what I mean if I use the
eLua constructs...

Welcome to eLua!

   M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eluino and constrain function

Hello Martin, good morning too :)

2013/3/8 martinwguy <[hidden email]>
Hello Gabriel and good morning. It is 7:30a.m. here.

I think that one of eLua's aims is to be small in code and memory use,
so mainline avoids adding features that are not necessary in the core.

For your project, you could implement that function in Lua, in an
include file (oops, sorry, a "require" file) and in less code.

Yes, I agree,  I will talk to Dado today and I we will discuss the better place to distribute it.
 

In general, when people only know one language and then meet a second
one, they usually try to program in the first language using the
second by #defining the second to look like the first, simply because
the first language forms your way of thinking about computer
programming, and provides your first vocabulary for programming
concepts.
I think the classic example is the original Bourne Shell, which was
written in C #defined to look like ALGOL, complete with IF THEN ELSE
ENDIF macros.

It's good as a personal programming exercise to help you understand
the correspondences between the two languages, but if you write real
programs in your new dialect, you isolate yourself from the community
that already speaks the second language.

I do agree too, but note, it's not for me, but for my friends that come from
Arduino world. I know Lua, no problemas, but my friends had some difficult
at first trying to understand Lua's syntax, then I decided to do this.
Is just a try to help them to give the first steps with Lua/eLua.

eluino is just a function wrapper, the rest of the language continues intact,
no macros, no new definitions.
 

Not that I like eLua's libraries - I would have implemented luaposix,
luasockets, luafs and their friends, specifically to unite with the
existing community and to be able to use hundreds of standard
libraries, but at least everyone understands what I mean if I use the
eLua constructs...

Welcome to eLua!

Thank you! :D 

   M

--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lucas R. Martins Lucas R. Martins
Reply | Threaded
Open this post in threaded view
|

Re: eluino and constrain function

I think that it's useful to port programs, libs, and most off all, mindsets from Arduino to eLua platforms.
Deserves a nice disclosure!


2013/3/8 Gabriel Duarte <[hidden email]>
Hello Martin, good morning too :)

2013/3/8 martinwguy <[hidden email]>
Hello Gabriel and good morning. It is 7:30a.m. here.

I think that one of eLua's aims is to be small in code and memory use,
so mainline avoids adding features that are not necessary in the core.

For your project, you could implement that function in Lua, in an
include file (oops, sorry, a "require" file) and in less code.

Yes, I agree,  I will talk to Dado today and I we will discuss the better place to distribute it.
 

In general, when people only know one language and then meet a second
one, they usually try to program in the first language using the
second by #defining the second to look like the first, simply because
the first language forms your way of thinking about computer
programming, and provides your first vocabulary for programming
concepts.
I think the classic example is the original Bourne Shell, which was
written in C #defined to look like ALGOL, complete with IF THEN ELSE
ENDIF macros.

It's good as a personal programming exercise to help you understand
the correspondences between the two languages, but if you write real
programs in your new dialect, you isolate yourself from the community
that already speaks the second language.

I do agree too, but note, it's not for me, but for my friends that come from
Arduino world. I know Lua, no problemas, but my friends had some difficult
at first trying to understand Lua's syntax, then I decided to do this.
Is just a try to help them to give the first steps with Lua/eLua.

eluino is just a function wrapper, the rest of the language continues intact,
no macros, no new definitions.
 

Not that I like eLua's libraries - I would have implemented luaposix,
luasockets, luafs and their friends, specifically to unite with the
existing community and to be able to use hundreds of standard
libraries, but at least everyone understands what I mean if I use the
eLua constructs...

Welcome to eLua!

Thank you! :D 

   M

--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Jerry Reed Jerry Reed
Reply | Threaded
Open this post in threaded view
|

Re: eluino and constrain function

Hi:

I'm new to eLua, but I would welcome the creation of a module (or whatever the appropriate term in the Lua vocabulary) supporting the Arduino Hardware Abstraction Layer. 

Perhaps some of the discussion on this thread may be triggered by the ambiguous way in which folks on the 'Net employ the term "Arduino".  In one meaning, it refers to a particular implementation of Atmel hardware, in another to a Processing-inspired IDE/preprocessor, and in a third, the loosest usage, to a "language".  The folks at arduino.cc talk about Arduino as if it were a seperate programming language, but I think it is better conceptualized as a C compiler coupled with a really neat Hardware Abstraction Layer (HAL) in the form of a library.

Using functions from the Arduino HAL such as:

 digitalWrite ( pinNum, HIGH) ;

is conceptually easier and more friendly than some machine-specific idiom such as:

PORT_A_REG |= ( 1 << pinNum ) ;

The simplicity and familiarity of this idiom is very attractive and is responsible for it's implementation as Energia on TI microprocessors, and for ports to the Raspberry Pi as well.

So if the proposal here is to incorporate the Arduino HAL within a Lua/eLua wrapper, then I think that would be really useful, and I can't see that it violate any fundamental philosophy of Lua, at least to the extent I understand it.

Thanks,

Jerry

On Fri, Mar 8, 2013 at 10:38 AM, Lucas R. Martins <[hidden email]> wrote:
I think that it's useful to port programs, libs, and most off all, mindsets from Arduino to eLua platforms.
Deserves a nice disclosure!


2013/3/8 Gabriel Duarte <[hidden email]>
Hello Martin, good morning too :)

2013/3/8 martinwguy <[hidden email]>
Hello Gabriel and good morning. It is 7:30a.m. here.

I think that one of eLua's aims is to be small in code and memory use,
so mainline avoids adding features that are not necessary in the core.

For your project, you could implement that function in Lua, in an
include file (oops, sorry, a "require" file) and in less code.

Yes, I agree,  I will talk to Dado today and I we will discuss the better place to distribute it.
 

In general, when people only know one language and then meet a second
one, they usually try to program in the first language using the
second by #defining the second to look like the first, simply because
the first language forms your way of thinking about computer
programming, and provides your first vocabulary for programming
concepts.
I think the classic example is the original Bourne Shell, which was
written in C #defined to look like ALGOL, complete with IF THEN ELSE
ENDIF macros.

It's good as a personal programming exercise to help you understand
the correspondences between the two languages, but if you write real
programs in your new dialect, you isolate yourself from the community
that already speaks the second language.

I do agree too, but note, it's not for me, but for my friends that come from
Arduino world. I know Lua, no problemas, but my friends had some difficult
at first trying to understand Lua's syntax, then I decided to do this.
Is just a try to help them to give the first steps with Lua/eLua.

eluino is just a function wrapper, the rest of the language continues intact,
no macros, no new definitions.
 

Not that I like eLua's libraries - I would have implemented luaposix,
luasockets, luafs and their friends, specifically to unite with the
existing community and to be able to use hundreds of standard
libraries, but at least everyone understands what I mean if I use the
eLua constructs...

Welcome to eLua!

Thank you! :D 

   M

--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Interested in bats?  Check out my blog at: http://www.karaokebats.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev