Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
-- -- Blink a LED on the Arduino Duemilanove using IDE libs from Atom/Haskell. -- June 2010 -- By Lee Pike (remove spaces) -- BSD3 -- module Main where import Language.Atom import Language.Atom.Scheduling import Data.Word atomName = "blink" -- | Invoke the Atom compiler. main = do (schedule, _, _, _, _) <- compile atomName defaults { cCode = prePostCode } blink putStrLn $ reportSchedule schedule varInit t var val = cType t ++ " " ++ var ++ " = " ++ val ++ ";" prePostCode _ _ _ = (unlines [ (varInit Int16 "ledPin" "13") , "void avr_blink(void);" ] , unlines [ "void setup() {" , " // initialize the digital pin as an output:" , " pinMode(ledPin, OUTPUT);" , "}" , "" , "void avr_blink() {" , " digitalWrite(ledPin, state." ++ atomName ++ ".on);" , "} // set the LED on or off" , "" , "void loop() {" , " " ++ atomName ++ "();" , "}" ] ) -- How many cycles is a phase? ph = 40000 -- Simple Atom to toggle an LED, leaving it on 8 times as long as it's off. blink = do on <- bool "on" True period ph $ phase 0 $ atom "blinkOn" $ do call "avr_blink" on <== not_ (value on) period ph $ phase (quot ph 8) $ atom "blinkOff" $ do call "avr_blink" on <== not_ (value on) |