| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

labb3

Page history last edited by Benjamin Tee 7 years, 12 months ago

Part A

a}int noteDurations[] = { 8, 16, 16, 8,8,8,8,8 };

b)STARWARS

Part B

a)

Low power operation support:

  2.7 to 5.5V

•  Wide range of liquid crystal display driver power

  3.0 to 11V

b) I had no mistakes

c) I changed the line of Lcd.print(¨ hello world¨)  and i wrote something instead of this line.

Part C

1-

a)

int sensorPin = A0;   
int ledPin = 9;  
int sensorValue = 0;  

void setup() {
  pinMode(ledPin, OUTPUT);  
}

void loop() {
  sensorValue = analogRead(sensorPin);    
  digitalWrite(ledPin, HIGH);  
   delay(sensorValue);          
  digitalWrite(ledPin, LOW);   
  delay(sensorValue);                  
}

I changed the code , instead of int Ledpin=13 , i used 9 .

2-

a)

 8.3 k ohm when it's flat.

 

The other situation, 16.8 kohm

 

b) [22kohm / (22 + 8)] 3.3 Volts = 2.42 Volts -flat

 

[22kohm / (22 + 16)] 3.3 Volts = 1.91 Volts - bent

c) Range of brightness is higher.

d)

 #include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int analogInPin = A0;
int sensorValue = 0;

void setup() {
  lcd.begin(16, 2);
  
  Serial.begin(9600); 
}

void loop() {
  lcd.setCursor(0, 1);
  sensorValue = analogRead(analogInPin);  
  sensorValue = analogRead(analogInPin);  
 lcd.print(sensorValue);
}

3-

a)

I saw the max value of 0.85 kohm when i press with my fingers and also i saw the max value of 1.4 kohm when i press with pencil.

b)

When the force applied , i saw that the relationship is npnlinear.

What is npnlinear?

c)

My code is

#include <LiquidCrystal.h>

 

int sensorPin1 = A0;    // select the input pin for the sensor

 

int sensorPin2 = A6;

 

 

 

int sensorValue1 = 0;  // variable to store the value coming from the sensor

 

int sensorValue2 = 0;

 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

 

 

 

void setup() {

 

 

 

  lcd.begin(16, 2);

 

  lcd.print("1.s          2.s");

 

}

 

 

 

void loop() {

 

  sensorValue1 = analogRead(sensorPin1); //read sensor input value

 

  sensorValue2 = analogRead(sensorPin2);

 

  lcd.setCursor(0,1);

 

  lcd.print(sensorValue1);

 

  lcd.setCursor(13,1);

 

  lcd.print(sensorValue2);   

 

}

4-

a)

I uploaded my video in another document in my account.

This is my code.

#include "pitches.h"

#include <LiquidCrystal.h>

 

int counter;

int melody[] = {NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int noteDurations[] = {

  4, 8, 8, 4,4,4,4,4 };

 

void setup() {

  lcd.begin(16, 2);

  lcd.print("basak dogan");

  counter=10;   noTone(8);

 

}

 

 

 

void loop() {

  lcd.clear();

  lcd.print("basak dogan");

  lcd.setCursor(0, 1);

 

 

 

  if(counter==0){

    lcd.print("time is up");

 

 

 for (int thisNote = 0; thisNote < 8; thisNote++) {

 

    // to calculate the note duration, take one second

    // divided by the note type.

    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.

    int noteDuration = 1000/noteDurations[thisNote];

    tone(8, melody[thisNote],noteDuration);

 

    // to distinguish the notes, set a minimum time between them.

    // the note's duration + 30% seems to work well:

    int pauseBetweenNotes = noteDuration * 1.30;

 delay(pauseBetweenNotes);

    // stop the tone playing:

    noTone(8);

 

    // Apply a negative value to

 

  }

  }

  else

{

  lcd.print(counter);

 

  delay(1000);

 

   counter=counter-1;

 

 

 

 

 

 }

}

 

Comments (1)

Benjamin Tee said

at 10:34 am on Aug 10, 2012

good job.
-0.5 for 3a
-0.5 for no video

You don't have permission to comment on this page.