Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: Long to Char Array and Back on: May 08, 2013, 01:56:47 am
shouldn't this work too?

Code:
for(int i =0; i < sizeof(byteArray); i++)
{
    anotherLongInt |= ( (long)byteArray[i]) << (i*8) );
}
2  Using Arduino / Programming Questions / Re: Ruby on rails and ardiuno's serial on: May 07, 2013, 03:17:56 am
Yea i am having these issues at the moment, anyone knows how i can make sure the thread shutsdown cleanly when the Rails server is stopped?
3  Using Arduino / Programming Questions / Re: Ruby on rails and ardiuno's serial on: May 03, 2013, 06:27:57 am
I got it working may not be the cleanest code but it works:

Code:
Thread.new{ serial_read }

def serial_read
  sp = SerialPort.new "COM4", 115200
  while true
puts sp.readline("\n")
# here you can handle the input from the serialport
  end
end

im using serialport gem

Thanks for help smiley
4  Using Arduino / Programming Questions / Re: Ruby on rails and ardiuno's serial on: May 02, 2013, 08:16:58 am
Quote
Do you have a link to some example using it in rails?
- http://lmgtfy.com/?q=ruby+on+rails+serial+events -

- https://github.com/railsbob/em-serialport -

already found that example, however i can not get it working.

I get the following error
Code:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

    C:/Ruby193/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
checking for main() in -lssl... no
creating Makefile

make
generating rubyeventmachine-i386-mingw32.def
compiling binder.cpp
cc1plus.exe: warning: command line option "-Wdeclaration-after-statement" is val
id for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wimplicit-function-declaration" is v
alid for C/ObjC but not for C++
In file included from binder.cpp:20:0:
project.h:26:0: warning: ignoring #pragma warning
In file included from binder.cpp:20:0:
project.h:85:0: warning: "FD_SETSIZE" redefined
<command-line>:0:0: note: this is the location of the previous definition
In file included from project.h:137:0,
                 from binder.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
                 from binder.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from binder.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from binder.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
compiling cmain.cpp
cc1plus.exe: warning: command line option "-Wdeclaration-after-statement" is val
id for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wimplicit-function-declaration" is v
alid for C/ObjC but not for C++
In file included from cmain.cpp:20:0:
project.h:26:0: warning: ignoring #pragma warning
In file included from cmain.cpp:20:0:
project.h:85:0: warning: "FD_SETSIZE" redefined
<command-line>:0:0: note: this is the location of the previous definition
In file included from project.h:137:0,
                 from cmain.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
                 from cmain.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from cmain.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from cmain.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
cmain.cpp:98:71: warning: type qualifiers ignored on function return type
cmain.cpp:109:122: warning: type qualifiers ignored on function return type
cmain.cpp:119:79: warning: type qualifiers ignored on function return type
cmain.cpp:129:83: warning: type qualifiers ignored on function return type
cmain.cpp:260:85: warning: type qualifiers ignored on function return type
cmain.cpp:270:84: warning: type qualifiers ignored on function return type
cmain.cpp:280:88: warning: type qualifiers ignored on function return type
cmain.cpp:290:51: warning: type qualifiers ignored on function return type
cmain.cpp:300:70: warning: type qualifiers ignored on function return type
cmain.cpp:320:55: warning: type qualifiers ignored on function return type
cmain.cpp:546:70: warning: type qualifiers ignored on function return type
cmain.cpp:669:68: warning: type qualifiers ignored on function return type
cmain.cpp: In function 'int evma_send_file_data_to_connection(long unsigned int,
 const char*)':
cmain.cpp:752:6: error: 'fstati64' was not declared in this scope
make: *** [cmain.o] Error 1


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/eventmach
ine-0.12.10 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/g
em_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.

P.S working on windows 7
5  Using Arduino / Programming Questions / Re: Ruby on rails and ardiuno's serial on: May 02, 2013, 08:06:47 am
Quote
I am interested in getting an event when serialdata is present and that be able to process it.
On the Arduino or in Ruby?


In ruby
6  Using Arduino / Programming Questions / Re: Ruby on rails and ardiuno's serial on: May 02, 2013, 07:52:07 am
Familiar with the EventMachine?
check out these examples - https://github.com/eventmachine/eventmachine/wiki/Code-Snippets -
Serial snippet is somewhere @75% of the page...

disclaimer - I'm no Ruby progger ..


No unfortunately i am not familiar with EventMachine, but i guess i can take a look into it smiley-wink
Do you have a link to some example using it in rails?



What events are you interested in? What does "does not shows by events" mean?


I am interested in getting an event when serialdata is present and that be able to process it.
7  Using Arduino / Programming Questions / Re: Ruby on rails and ardiuno's serial on: May 02, 2013, 07:18:35 am
Thanks for the quick reply, however this does not shows by events.
Maybe i have to poll it?

Gz,
8  Using Arduino / Programming Questions / Ruby on rails and ardiuno's serial on: May 02, 2013, 07:15:31 am
Hi,

I am creating a ruby on rails application and i was wondering if its possible to have my application respond to serialdata from the USB/COM port of my Arduino (preferably by events).

If so, does anyone has an example on how to do this?

Thanks in advance
9  Using Arduino / Sensors / Re: RDM880 rfid reader on: April 03, 2013, 05:06:26 am
Quote
This probably won't work very well.

Why does it not?

Quote
Show us the code that is working fine.

The code i posted is correct, but i removed the include lines

Quote
What does "not working" mean? Do you get nothing back? Do you get garbage back? Do you get unexpected card numbers?

Not working means i DO get the serialnumber but the halt command is not executed
10  Using Arduino / Programming Questions / Re: comparison between pointer and integer ? on: March 29, 2013, 10:44:52 am
A * or asterisk as its called, in front of a pointer is called a dereference operator, it could be seen as (literally translated) "value pointed by".

some nice information about pointers can be found here http://www.cplusplus.com/doc/tutorial/pointers/
11  Using Arduino / Programming Questions / Re: comparison between pointer and integer ? on: March 29, 2013, 09:24:47 am
if i understand your question correctly tuloLampo is an integer pointer and VS is a float?

if so you would be able to compare it like

Code:
if ((*tuloLampo)+5 > (int)(VS))
{
}

however casting the float to an int might be a problem because it will become a round number.
12  Using Arduino / Sensors / Re: RDM880 rfid reader on: March 29, 2013, 03:45:58 am
Thanks for ur reaction, here is more information

Q: How have you connected the module to the Arduino?

A: I connected the module this way:
5v arduino <-> power module
GND arduino <-> GND module
Rx arduino <-> Tx module
Tx arduino <-> Rx module.

Q: Show us the code you're using!

A: This is not the real code but works in a similair way
Code:
....

byte command[] = {0xAA ,0x00, 0x03, 0x25, 0x26, 0x01, 0x01, 0xBB}
void setup()
{
    Serial.begin(115200);
    Serial1.begin(9200);
    for(int i =0; i < sizeof(command); i++)
    {
        Serial1.write(command[i]);
    }
}

void loop()
{

}

void serialEvent1()
{
    while(Serial1.available() > 0)
    {
         Serial.write(Serial1.read());
    }
}


Q: Where do you have the command sequence from?

A: The command sequence i got from the documentation at http://www.seeedstudio.com/wiki/index.php?title=13.56Mhz_RFID_module_-_IOS/IEC_14443_type_a

Q: Why do you want to do that? What are you trying to achieve?

A: I wish to execute the halt command to stop the module from detecting the same tag over and over again while it is in the modules reading range, So that other tags can be read too.
13  Using Arduino / Sensors / RDM880 rfid reader on: March 26, 2013, 04:02:47 am
Hi,

I have bought RDM880 rfid reader/writer modules and am trying to use them with my arduino Mega. Everything is working fine and i am capable of reading RFID serial numbers from the tags. However when i want to use commands specified in the datasheet it is not working.

The command i am trying to use is reading and halting the card/tags serial number.

command: 0xAA 0x00 0x03 0x25 0x26 0x01 0x01 0xBB

Anyone has experienced these issues with these modules?

Thanks in advance
14  Using Arduino / Programming Questions / serialEvent(1/2/3) in library class on: March 21, 2013, 04:27:58 am
Hi,

I was wondering if it is possible to have the serialEvent(1/2/3) function to be replaced by class::serialEvent(1/2/3) in one of my library classes. Is this possible or is there any other way to do something similar?

Thanks in advance
15  Using Arduino / Project Guidance / Re: Arduino Uno or Arduino Mega on: March 07, 2013, 08:08:44 am
Thanks smiley this is all i needed to know
Pages: [1] 2