This document contains code snippets for controlling an LED or reading sensor values using an Arduino board. The snippets demonstrate basic digital input/output functions like turning an LED on and off, fading an LED brightness over time, reading the state of a push button to control an LED, reading analog sensor values to control LED brightness, receiving serial data to set LED brightness, and sending mouse position data over serial.
Presentation slides used during the outreach program with Si Ling Secondary School. Look through the slides to get a better idea of what are covering during the lesson itself and what to expect from the lesson. The LED Cube can be programmed with simple instructions from Arduino, easily understood because its syntax is similar to that of English. Join us for an amazing class on electronics and we are sure it will change your mind about electronics engineering after which. Find out more, drop us an email at ong_siok_bie@ite.edu.sg
Proudly presented by ITE College West EC Department
Presentation slides used during the outreach program with Si Ling Secondary School. Look through the slides to get a better idea of what are covering during the lesson itself and what to expect from the lesson. The LED Cube can be programmed with simple instructions from Arduino, easily understood because its syntax is similar to that of English. Join us for an amazing class on electronics and we are sure it will change your mind about electronics engineering after which. Find out more, drop us an email at ong_siok_bie@ite.edu.sg
Proudly presented by ITE College West EC Department
I have prepared this presentation when I was studying at Western Region Campus. I along with some of my friends conducted training for junior students on Arduino. Its day-1 presentation.
hands-on Arduino introduction making a sequencer to send 3 channels of pulse signals to a drum chip (Arduino based dsp-D8)
designed for 2 workshops at Sonar Hong Kong, 17 March 2018
verilog code and Test bench for
Basic Gate
half adder
full adder
half subtractor
full subtractor
mux
demux
encoder
decoder
BCD to E-3
E-3 to BCD
binary to BCD
BCD to binary
Ripple carry adder
Temperature sensor with a led matrix display (arduino controlled)TechLeap
Basic idea was to build a simple, cheap temperature sensing circuit-manually calibrated. then display the temperature in real-time on an 8x8 LED matrix.
I have prepared this presentation when I was studying at Western Region Campus. I along with some of my friends conducted training for junior students on Arduino. Its day-1 presentation.
hands-on Arduino introduction making a sequencer to send 3 channels of pulse signals to a drum chip (Arduino based dsp-D8)
designed for 2 workshops at Sonar Hong Kong, 17 March 2018
verilog code and Test bench for
Basic Gate
half adder
full adder
half subtractor
full subtractor
mux
demux
encoder
decoder
BCD to E-3
E-3 to BCD
binary to BCD
BCD to binary
Ripple carry adder
Temperature sensor with a led matrix display (arduino controlled)TechLeap
Basic idea was to build a simple, cheap temperature sensing circuit-manually calibrated. then display the temperature in real-time on an 8x8 LED matrix.
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
What will be quantization step size in numbers and in voltage for this Arduino Code? Using 5V
const int led1 = 2;
const int led2 = 3;
const int led3 = 4;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
int dataConv = sensorValue*(8.0/1024);
//write analog equvivalant data on led pins
switch(dataConv)
{
case 0: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 1: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 2: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 3: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 4: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 5: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 6: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
case 7: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
}
Serial.println(sensorValue); // print out the value you read:
Serial.println(dataConv);
delay(1000); // delay in between reads for stability
}
const int led1 = 2;
const int led2 = 3;
const int led3 = 4;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
int dataConv = sensorValue*(8.0/1024);
//write analog equvivalant data on led pins
switch(dataConv)
{
case 0: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 1: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 2: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 3: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 4: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 5: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 6: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
case 7: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
}
Serial.println(sensorValue); // print out the value you read:
Serial.println(dataConv);
delay(1000); // delay in between reads for stability
}
Solution
// Random LED Dots - from noise source
// Ed Nisley - KE4ANU - September 2015
//----------
// Pin assignments
const byte PIN_HEARTBEAT = 8; // DO - heartbeat LED
const byte PIN_SYNC = A3; // DO.
Arduino is an open- source computer hardware and software company, project and user community that designs and manufactures microcontroller-based kits for building systems consisting of digital devices, interactive objects that can sense and control in the physical world.
Lab_5.txt.rtfLab_05Design an application that reads the .docxDIPESH30
Lab_5.txt.rtf
/*
Lab_05
Design an application that reads the status of pin 2 that is attached to a switch.
This status of pin 2 should be reflected on pin 3 with a LED.
Please utilize structured programming methodology.
9/10/2014
*/
const int buttonPin = 2; // the pin that the pushbutton is attached to
const int ledPin = 3; // the pin that the LED is attached to
// Variables will change:
int buttonState = 0; // current state of the button
void setup()
{
// initialize the button pin as a output:
pinMode(buttonPin, OUTPUT);
// initialize the LED as an input:
pinMode(ledPin, INPUT);
Serial.begin(9600);
}
int main()
{
setup();
while(1)
{
buttonState = function_in();
function_out(buttonState);
}
return 0;
}
int function_in(void)
{
int bs=digitalRead(buttonPin);
return bs;
}
void function_out(int buttonState_1)
{
// check if the pushbutton is pressed
// if it is, the pushbuttonState is HIGH:
if (buttonState_1 == HIGH)
{
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
Lab_06.txt.rtf
/*
Lab_06
Repeating lab_04 with standard C format
more formalized
Label definition with formal function declaration
function calls
body of functions clearly demarcated
9/10/2014
*/
// constants won’t change. They’re used here to
// set pin numbers:
// the # define construct is a compiler pre-processor directive.
// the value is substituted for the name, wherever the name occurs
//in the source code. So, something like:
# define buttonPin 2 // the number of the pushbutton pin
# define ledPin 3 // the number of the led pin
// function declarations
void setup(void);
int function_in(void);
void function_out(int);
int main()
{
int buttonState = 0; // variable for reading for the pushbutton status
setup();
while(1)
{
// function call without arguments:
buttonState = function_in();
// function call without argument
function_out(buttonState);
}
return 0;
}
int function_in(void)
{
int bs = digitalRead(buttonPin);
return bs;
}
void function_out( int buttonState_1)
{
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if(buttonState_1==HIGH)
{
// trun LED on:
digitalWrite(ledPin, HIGH);
}
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
Lab_07.txt
/*
Lab_07
The applcation is going to blink first leds attched 3 times
and then make next 3 led five times.
Date: 09/15/2014
*/
// Pin 13 has an LED connected on most Arduino boards.
// Pin 12 has the LED on Teensy 2.0
// Pin 11 has the LED on Teensy++ 2.0
// Pin 10 has the LED on Teensy 3.0
// Pin 9 has the LED on Teensy 2.0
// Pin 8 has t ...
At the end of the topic you should be able to:
1. Explain the importance of platform based development
2. Use looping, delay and conditioning concepts in developing a program on Arduino environment.
Maker Faire Tokyo 2018( http://makezine.jp/event/mft2018/ )での特別講演「テクノロジーの“辺境”—「枯れた技術の水平思考」をレンズとして」で使用したスライドです。
スライドキャストはこちらです。☞https://youtu.be/zThCaeLxKnI
Slides prepared for the worksop at the Macao Polytechnic Institute on 5th April, 2016.
Please get examples from the following URL:
https://github.com/kotobuki/esp8266_examples
Can AI do good? at 'offtheCanvas' India HCI preludeAlan Dix
Invited talk at 'offtheCanvas' IndiaHCI prelude, 29th June 2024.
https://www.alandix.com/academic/talks/offtheCanvas-IndiaHCI2024/
The world is being changed fundamentally by AI and we are constantly faced with newspaper headlines about its harmful effects. However, there is also the potential to both ameliorate theses harms and use the new abilities of AI to transform society for the good. Can you make the difference?
7 Alternatives to Bullet Points in PowerPointAlvis Oh
So you tried all the ways to beautify your bullet points on your pitch deck but it just got way uglier. These points are supposed to be memorable and leave a lasting impression on your audience. With these tips, you'll no longer have to spend so much time thinking how you should present your pointers.
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...Mansi Shah
This study examines cattle rearing in urban and rural settings, focusing on milk production and consumption. By exploring a case in Ahmedabad, it highlights the challenges and processes in dairy farming across different environments, emphasising the need for sustainable practices and the essential role of milk in daily consumption.
Transforming Brand Perception and Boosting Profitabilityaaryangarg12
In today's digital era, the dynamics of brand perception, consumer behavior, and profitability have been profoundly reshaped by the synergy of branding, social media, and website design. This research paper investigates the transformative power of these elements in influencing how individuals perceive brands and products and how this transformation can be harnessed to drive sales and profitability for businesses.
Through an exploration of brand psychology and consumer behavior, this study sheds light on the intricate ways in which effective branding strategies, strategic social media engagement, and user-centric website design contribute to altering consumers' perceptions. We delve into the principles that underlie successful brand transformations, examining how visual identity, messaging, and storytelling can captivate and resonate with target audiences.
Methodologically, this research employs a comprehensive approach, combining qualitative and quantitative analyses. Real-world case studies illustrate the impact of branding, social media campaigns, and website redesigns on consumer perception, sales figures, and profitability. We assess the various metrics, including brand awareness, customer engagement, conversion rates, and revenue growth, to measure the effectiveness of these strategies.
The results underscore the pivotal role of cohesive branding, social media influence, and website usability in shaping positive brand perceptions, influencing consumer decisions, and ultimately bolstering sales and profitability. This paper provides actionable insights and strategic recommendations for businesses seeking to leverage branding, social media, and website design as potent tools to enhance their market position and financial success.
Book Formatting: Quality Control Checks for DesignersConfidence Ago
This presentation was made to help designers who work in publishing houses or format books for printing ensure quality.
Quality control is vital to every industry. This is why every department in a company need create a method they use in ensuring quality. This, perhaps, will not only improve the quality of products and bring errors to the barest minimum, but take it to a near perfect finish.
It is beyond a moot point that a good book will somewhat be judged by its cover, but the content of the book remains king. No matter how beautiful the cover, if the quality of writing or presentation is off, that will be a reason for readers not to come back to the book or recommend it.
So, this presentation points designers to some important things that may be missed by an editor that they could eventually discover and call the attention of the editor.
Hello everyone! I am thrilled to present my latest portfolio on LinkedIn, marking the culmination of my architectural journey thus far. Over the span of five years, I've been fortunate to acquire a wealth of knowledge under the guidance of esteemed professors and industry mentors. From rigorous academic pursuits to practical engagements, each experience has contributed to my growth and refinement as an architecture student. This portfolio not only showcases my projects but also underscores my attention to detail and to innovative architecture as a profession.
26. void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
27. void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
28.
29.
30. int brightness = 0;
int fadeAmount = 5;
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
// set the brightness of pin 9:
analogWrite(9, brightness);
brightness = brightness + fadeAmount;
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
delay(30);
}
31.
32.
33.
34.
35. const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
36.
37.
38.
39.
40. const int sensorPin = A0;
const int ledPin = 9;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
// read the value from the sensor:
int sensorValue = analogRead(sensorPin);
// scale from 0-1023 to 0-255
int intensity = map(sensorValue, 0, 1023, 0, 255);
// sets the value
analogWrite(ledPin, intensity);
}
41.
42.
43.
44. const int ledPin = 9;
void setup() {
// initialize the serial communication:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
byte brightness;
// check if data has been sent from the computer:
if (Serial.available()) {
// read the most recent byte (0-255)
brightness = Serial.read();
// set the brightness of the LED:
analogWrite(ledPin, brightness);
}
}
45. import processing.serial.*;
Serial port;
void setup() {
size(256, 150);
// Print available serial ports
println(Serial.list());
port = new Serial(this, "COM1", 9600);
}
void draw() {
// draw a gradient from black to white
...
// send the current X-position of the mouse
port.write(mouseX);
}