Building own API - Arduino Yun

Hello Arduino Users.

My goal is to get led 13 to blink after i call my own API like for example:


I’am lost how to get it looped… how do i get this to work?
I got this to work without the API… But then the arduino just reads a simple state… 1/0 not blinkfast or blinkslow.
How can i get a function to do this? (I used the bridge example to get started)

Any idea’s to push me in the right direction… i need to save the state of blinking some how!?

void loop() {

  // Get clients coming from server
  YunClient client = server.accept();

  int waarde = digitalRead(13);

  if (waarde==1) {
    digitalWrite(13, HIGH);
    digitalWrite(13, LOW);
    digitalWrite(13, HIGH);
  // There is a new client?
  if (client) {
    // Process request

    // Close connection and free resources.

  delay(50); // Poll every 50ms

The Bridge example does almost what you want to do. Have you started from there?