Show Posts
Pages: 1 [2] 3 4 ... 343
16  International / Deutsch / Re: Ardino DUE Pin-Change Interrupts on: June 16, 2014, 07:28:37 am
Das ist der Code für die ersten 20 Pins (als Beispiel). Du hast dann die Jump-Table simple_handler[], welche dann den complex_handler() mit der entsprechenden Pin-Nummer aufruft.

Code:
typedef void (*phandler)();
phandler simple_handler[20];
#define def_handler(num)  void handler##num() { complex_handler(num); }
#define add_handler(num)  simple_handler[num] = &handler##num;

def_handler(2)
def_handler(3)
def_handler(4)
def_handler(5)
def_handler(6)
def_handler(7)
def_handler(8)
def_handler(9)
def_handler(10)
def_handler(11)
def_handler(12)
def_handler(13)
def_handler(14)
def_handler(15)
def_handler(16)
def_handler(17)
def_handler(18)
def_handler(19)

void setup() {
  add_handler(2)
  add_handler(3)
  add_handler(4)
  add_handler(5)
  add_handler(6)
  add_handler(7)
  add_handler(8)
  add_handler(9)
  add_handler(10)
  add_handler(11)
  add_handler(12)
  add_handler(13)
  add_handler(14)
  add_handler(15)
  add_handler(16)
  add_handler(17)
  add_handler(18)
  add_handler(19)
}

void setDigitalInputs(){
  for(int i = startPort; i<=endPort;i++){
     pinMode(i, INPUT);
     attachInterrupt(i, simple_handler[i], flanke);
  }
}

Der Code ist nicht getestet, kann also noch Fehler enthalten.
17  Using Arduino / Networking, Protocols, and Devices / Re: BC127 Software Serial not reading on: June 16, 2014, 05:03:08 am
The module has two RX and TX pins. Which are you connecting to? The ones on the long side or on the short side (FTDI connector)?

From the schematics you can see that the RXI is connected only with a resistor in series with the chip, while for the TXO a level converter is installed.
18  Using Arduino / Networking, Protocols, and Devices / Re: Please help arduino uno + wifly: turn a led remotely. on: June 16, 2014, 04:28:44 am
The RN-XV uses a UART to communicate with the Arduino while the WiFly shield has a SPI-UART on the board. You cannot use software written for the later on the former board.
My experience with the RN-XV is that it works as a charm on the hardware serial but I never got it to run reliably with a SoftwareSerial emulation on other pins (at least not with a reasonable baud rate).

So either do the debugging over a SoftwareSerial (or better a AltSoftSerial) or get a Mega2560 with 4 hardware serial interfaces.
19  Topics / Device Hacking / Re: How to hack a single micro usb for charging and data transfer at same time. on: June 16, 2014, 04:22:48 am
Quote
Is this a right method?

This is probably not a problem of the connector or the signals on it but of the USB hardware in your tablet. Usually if the USB is in host mode it supplies power to the devices while during charging it must be in slave mode as it is consuming power. If you want to do both at the same time, you have to check if the USB hardware in your tablet is able to be configured to that (which is against the USB specification).
20  Topics / Device Hacking / Re: Controlling Automower on: June 16, 2014, 04:18:23 am
Quote
I can only guess, but it might be possible that the Automower gives feedback that has more than 5 Bytes and therefore I have the issue. In that case the script is not in sync anymore.

That's no reason to reset the Arduino. If you're unsure clear the serial buffer from time to time.

Quote
However I have a new issue with your code:

Why do you think this has anything to do with "my" code?
Your code formatting is still horrible. Please take the time to use the AutoFormatter in the IDE at least.

Although it should make a significant difference, change the code

Code:
#define BUFFERSIZE 40
uint8_t buffer[BUFFERSIZE];
uint8_t i = 0;
while (i < BUFFERSIZE) {
  if (client.available()) {
    uint8_t c = client.read();
    if (c == '/') break;
    buffer[i++] = c;
  }
}

to

Code:
#define BUFFERSIZE 40
uint8_t buffer[BUFFERSIZE];
uint8_t i = 0;
while (i < BUFFERSIZE) {
  if (client.available()) {
    uint8_t c = client.read();
    if (c == '/') break;
    buffer[i++] = c;
  }
}
if (i < BUFFERSIZE) buffer[i] = 0;

In digitalCommand() and analogCommand() you're still using the String class. Why?
21  Using Arduino / Networking, Protocols, and Devices / Re: BC127 Software Serial not reading on: June 13, 2014, 12:45:18 pm
Quote
I'll try flipping it around again, but I started off with RX to RX and TX to TX and I couldn't get any communication. According to this turtorial from Sparkfun, they have the RX going to TX.

That for the shield not for the breakout. Please provide a link to the hardware you are using.
22  Using Arduino / Networking, Protocols, and Devices / Re: Why client.connect or client.write wont work after a particular function on: June 13, 2014, 12:41:54 pm
Post your sketch and links to all libraries used unless they are distributed with the Arduino IDE. Also provide links to the datasheets of the used sensors and a wiring diagram.

It's not a general problem because I have several application that does Ethernet connections after reading I2C sensors, and they work reliably. So the error is in your code (or your hardware).
23  Using Arduino / Networking, Protocols, and Devices / Re: Speed (latency) of ENC28J60 module / ethernet on: June 13, 2014, 12:38:32 pm
Quote
Do UDP or serial reduces response times?

UDP will reduce response times but you cannot use it from a browser. What kind of serial are you thinking about? A network is also a serial connection.

Quote
I do not want to go the YUN or Pi way, but I think half a second is quite something!

Yes, half a second is more than I would expect. Please post the code that is producing this response time. And provide a link to the library you're using for that (there a several different libraries for the ENC28J60 chip).

Quote
Will the W5100 increase response times as well?

It might as most of the low level TCP/IP stuff is done in the chip directly without bothering the ATmega of the Arduino.
What is the Arduino doing to deliver the response? What kind of data is in these 16 bytes?
24  Using Arduino / Networking, Protocols, and Devices / Re: Speed (latency) of ENC28J60 module / ethernet on: June 13, 2014, 07:28:37 am
Post the sketch you're running as well as a link to the library you're using. What speed do you expect from the Arduino? Depending on these needs you may have to change the Arduino you're using and choose a Yun (or something similar) as there an embedded Linux system is handling network requests which enhances latency by factors.

BTW: the value you get in browser debuggers is not the network latency but the time need for a complete request/response cycle which usually means that multiple packets are transferred over the network.

Using an Arduino Ethernet Shield (with a WizNet5100 chip) will enhance the latency but not necessarily the response times of your Arduino application.

As I already wrote, a Yun may be your Arduino of choice if you need fast response times. If you need even more speed, change to an embedded Linux system (Raspberry Pi, CubieBoard, PCduino, etc.).
25  Using Arduino / Networking, Protocols, and Devices / Re: Please help arduino uno + wifly: turn a led remotely. on: June 13, 2014, 07:12:53 am
You forgot the code tags so we maybe don't see the complete code but it's obvious that the code doesn't compile because you're using variables (p.e. ssid, passphrase, etc.) that are nowhere defined in your sketch.

What hardware are you using? Please post a link to the hardware and to the used library (there is more than one library called WiFly).
26  Using Arduino / Networking, Protocols, and Devices / Re: help with wireless serial between 2 arduinos on: June 13, 2014, 07:06:33 am
Quote
when i said i disconnected ground i meant from the two arduinos in the test stage when i didn't use the wireless modules and connected them directly to each other and tested the simple sketch used above

If you connect two devices (being an Arduino or any other device) serially, you always have to connect at least the ground in addition to the RX/TX signals.

Quote
i then wanted to advance to the wireless stage so i connected everything like in this picture below:

In this picture there is also no ground connection and I also cannot see a power connection. A ground connection between the Arduino and the module is necessary (to have a common level basis) and you also need power for the modules from anywhere, the Arduino might be the power source, if you take some other source, don't forget to also connect the ground from that source to the common ground of all devices.
27  Using Arduino / Networking, Protocols, and Devices / Re: Problems with sim908 and coordinates on: June 13, 2014, 07:00:43 am
Quote
Hello pylon, we are testing outdoor with hardware inside a plastic box, we use this antenna http://www.cooking-hacks.com/internal-gps-antenna, most positions are on 10m radius from real position, but some positiong give the wrong position, we take 72 position and only 2 are bad.

You may be outdoors but inside a town and I guess that you have high buildings around you. Depending on the current satellite positions there may be smaller or bigger errors because of that (absorptions and reflections). Did you try under an open sky?

I don't know your specific GPS hardware but I have quite some experience with other GPS hardware under varying circumstances and if that hardware is not installed on a ocean ship or something similar, never trust a single measurement, always take several and build some meaningful average from them.
28  Using Arduino / Networking, Protocols, and Devices / Re: help with wireless serial between 2 arduinos on: June 13, 2014, 04:48:00 am
Quote
then i disconnected ground cable between them and everything became gibberish as i suspected so wondered if it will somehow still work wirelessly

Between what? The two wireless modules? Why would you do so?

On you picture you don't have a power and ground connection between the Arduino and the module? I guess for your tests you did connect them, didn't you?

Please provide a wiring diagram of your current setup and the sketch you're doing your tests with.
29  Using Arduino / Networking, Protocols, and Devices / Re: Arduino and the adf7012 on: June 13, 2014, 04:42:02 am
This project https://github.com/tkrahn/PecanPico seems to have used it. If that's not a sufficient answer, provide more information and ask more detailed.
30  Using Arduino / Networking, Protocols, and Devices / Re: Problems with sim908 and coordinates on: June 13, 2014, 04:38:54 am
The coordinates look like you're inside a building and the GPS reading is about 300m off your real position. That's an acceptable offset for your situation in my opinion given that you're using a GPS module with only a small integrated antenna. Go to an outdoor place where you have at least a 90° clear sky (no obstacles like trees or buildings) and measure again. You'll probably get readings that are accurate to about 5-10m.
Pages: 1 [2] 3 4 ... 343