1var check = 1; 2 3function blink() { 4 var inp = gpio_get(0); 5 var blk = (check > 8) ? 1 - inp : inp; 6 gpio_set(2, blk); 7 check = check >= 10 ? 1 : check+1; 8} 9 10// GPIO 0 as input 11// GPIO 2 as output 12gpio_dir(0, 0); 13gpio_dir(2, 1); 14 15print("blink js OK"); 16