Lab 1: Intro to Physical Computing


// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(A0, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(A0, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(A0, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
float intensity = 125;// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(9, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
intensity += random(-10,10);
analogWrite(9, int(intensity));
delay(100);
}

--

--

--

CS PhD Student at Berkeley. Art, Computers, and Education.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Servlet and JSP for web development

Deploying services over docker swarm

Dockerize your projects in Visual Studio Code

Technical Writing Trends in 2019

Create Note Boxes in Online Documentation with HTML and CSS

TEXT TO SPEECH

360 Video + Audio Pipeline with Free Software

Developing and Publishing a custom pod to Cocoapods library

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Rawn

Eric Rawn

CS PhD Student at Berkeley. Art, Computers, and Education.

More from Medium

War & Survival

The Technology of Addiction — Research Is Obtaining Responses

Jewel House Ghazal

Root cause analysis on unusual stack writing functions with IDA.