---
# System prepended metadata

title: UKR VAJE (old)

---

## //Naloga izpiše števila od 1 do 15
``` c=
int seznam[] = {1,2,4,8,16,32,64,128,255,0,255,0,255};

void setup() {
  // put your setup code here, to run once:
  for(int i = 0; i < 8; i++){
      pinMode(i, OUTPUT);
  }


}

void loop() {
  // put your main code here, to run repeatedly:
  for(int i=0; i < 15; i++){
    PORTD = seznam[i];
    delay(300);
  }
}
```
![image](https://hackmd.io/_uploads/SykRLN4Ua.png)

## Random number
``` c=
void setup() {
  // put your setup code here, to run once:
  randomSeed(analogRead(A0));
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  int stevilo = random(1, 11); //1 od 10
  Serial.println(stevilo);
  delay(500);
}
```

## Lučke
``` c=
int ledPin[] = {1, 2, 4, 8, 16, 32, 64, 128, 255, 0, 255};
void setup() {
  // put your setup code here, to run once:
  DDRD = 0xFF;
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int x = 0; x < 8; x++){
    PORTD = ledPin[x];
    delay(300);
  }
}
```
![image](https://hackmd.io/_uploads/r1jSqwpLa.png)

## LCD 16x2
``` c=

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,10,9,8,7);
int pot=A0;
int value;

void setup() {
  // put your setup code here, to run once:
  lcd.begin(16,2);
  lcd.setCursor(0,0);
  lcd.print("Pot value: ");
  //pinMode(pot,INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  value=analogRead(pot);
  lcd.setCursor(0,1);
  lcd.print(value);
 
}
```
![image](https://hackmd.io/_uploads/B1ZsKlBYp.png)
## funkcija za izpis besedil, števil in znakov
```c=
//funkcija za izpis besedil, števil in znakov
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,10,9,8,7);

byte hertz[8] = {
  0b00000,
  0b01010,
  0b11111,
  0b11111,
  0b11111,
  0b01110,
  0b00100,
  0b00000
};

void setup() {
  // put your setup code here, to run once:
  lcd.begin(16,2);
  lcd.createChar(2,hertz);
}

void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(0,0);
  lcd.write(2);
  textPrint("Besedilo");
  steviloPrint(10);
}


void textPrint(char text[]){ //(char *text) ali (String text)
  lcd.setCursor(0,1);
  lcd.print(text);
}

void steviloPrint(int x){
  lcd.setCursor(14,1);
  lcd.print(x);
}
```
![image](https://hackmd.io/_uploads/Sk0A-Wrta.png)

# http://194.249.229.147/

## 
```=c
```