the Code they came up with is:

void setup() {
  for (uint8_t pin = 14; pin < 14 + 32; pin++) {
    pinMode(pin, INPUT_PULLUP);
  }
  Serial.begin(250000);
}

void loop() {
  static unsigned long iterations;
  static unsigned long lastSecond;
  unsigned long topLoop = millis();
  iterations++;
  uint8_t pin = 14;
  for (uint8_t bytes = 0; bytes < 4; bytes++) {
    uint8_t eightBits = 0;
    for (uint8_t bits = 0; bits < 8; bits++) {
      bitWrite(eightBits, bits, !digitalRead(pin++)); // HIGH als 0, LOW 
als 1
    }
    if (eightBits < 16) {
      Serial.write('0');
    }
    Serial.print(eightBits, HEX);
  }
  Serial.println();
  if (topLoop - lastSecond >= 1000) {
    Serial.print(iterations);
    Serial.println(F(" / second"));
    iterations = 0;
    lastSecond = topLoop;
  }
}

the Arduino will spit out over 2000 times every second

Am Donnerstag, 6. Juli 2017 09:56:42 UTC+2 schrieb Schooner:
>
>
> On 05/07/17 22:01, Sag ich Dir nich wrote: 
> > how responsive were your inputs? mine take a couple of seconds, 
> > sometimes dont even get recognized and sometimes are recognized but i 
> > have not pushed the button 
> > 
> It was just an example of how to transfer the data from arduino to HAL, 
> plenty of scope for tuning. 
>
> The baud rate is probably set at B9600 
> You can increase this up to B115200 with the arduino, just make sure 
> both ends are set the same. 
>
> Then look at the delay() in the arduino script and usleep() in the 
> component 
> They are both set to quite long periods (1 sec - ie 1000ms and 1000000us 
> respectively) 
>
> This could be reduced without impacting performance too much, depends 
> what else is going on. 
>
> Time to start learning what the code does I'm afraid.  The arduino IDE 
> is a pretty easy way to get into C / C++. 
>

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to