Coder Social home page Coder Social logo

fp2's Introduction

My Library: (library name here)

My name: Alexander Gribov

For FP2, I decided to explore the arduino interface, so that I could learn how to use hardware (buttons, lights, and potentiometers) with racket. Unfortunately, my Arduino lit up and then broke when I plugged it in, and my roomates Arduino won't let me upload the code, but I wrote it anyways and will test when my new one comes in the mail.

Basically, I used one of the examples to figure out the syntax, and then wrote a program that uses racket to make LED's blink, and chance the speed and brightness with a potentiometer, as well as turn them on/off with a button.

The Arduino sketch uploaded is simply the pre-made ASIP sketch, which starts the serial communication. AFter that everything is in Racket. This interface is really cool, because it allows you to use Functional logic to control hardware, and also use harware to send signals to racket. For example:

(define led1 11) ;; Defines which I/O pin to use
(define led2 12)
...
    (set-pin-mode led1 OUTPUT_MODE) ;;Defines led1 to be an output pin
    (set-pin-mode led2 OUTPUT_MODE)
    ...
    (map (λ (x) (digital-write x LOW)) (list led1 led2))

This uses Racket's higher order map function to turn off a series of LED's Later in the code, racket functions are used to control the LED's in other ways.

Here's a picture of my circuit which I can't test! Image of Circuit

fp2's People

Contributors

marksherman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.