matpi / EmbeddedSystemsUTU

This repository concerns the course KSA4 Embedded Systems (craft, design and technology education) in the University of Turku, Department of Teacher Education, Rauma Unit in the academic year 2014
4 stars 5 forks source link

=D HOX! Mielenkiintoinen sivusto: valmiita ohjeita ja ohjelmia #35

Open jumap opened 9 years ago

jumap commented 9 years ago

Täältä löydät ohjeita ja valmiita ohjelmia harjoitteluun. On myös KIRJASTOJA esim. äänen korkeuden määrittämiseen : pithces.h (tämä pitää kopioida ja liittää arduinon ohjelmassa uutena välilehtenä sekä tallentaa)

https://itp.nyu.edu/physcomp/labs/labs-arduino-digital-and-analog/

On myös KIRJASTOJA

Esimerkki ohjelmasta, jossa voit kokeilla erilaisia melodioita "Play Tones

Write a sketch to read the analog input and map the result to a range from 100 to 1000. Store the result in a local variable called frequency. This will be the frequency you play on the speaker Then use the tone() command to set the frequency of the speaker on pin 8. void setup() { // nothing to do here }

void loop() { // get a sensor reading: int sensorReading = analogRead(A0); // map the results from the sensor reading's range // to the desired pitch range: float frequency = map(sensorReading, 200, 900, 100, 1000); // change the pitch, play for 10 ms: tone(8, frequency, 10); } "