Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. hardware.pin1.configure(DIGITAL_OUT)
  2. server.setsendtimeoutpolicy(RETURN_ON_ERROR, WAIT_FOR_ACK, 10)
  3.  
  4. data <- blob(4096)
  5. state <- 0
  6.  
  7. function blink()
  8. {
  9. // Turn LED on or off
  10.  
  11. hardware.pin1.write(state)
  12.  
  13. // Write a message to the server
  14. // (we append data to end to simulate sending lots data)
  15.  
  16. server.log(state.tostring() + data.tostring())
  17.  
  18. // Flip state
  19.  
  20. if (state == 1) state = 0; else state = 1
  21.  
  22. // Call blink with new state
  23.  
  24. imp.wakeup(0.01, blink)
  25. }
  26.  
  27. blink()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement