GithubHelp home page GithubHelp logo

kopunk / adv_arduino_ir_remote Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 111 KB

Advanced Arduino IR Remote with remote manager PC app

C++ 65.19% C 11.94% Python 22.87%
arduino arduino-serial arduino-uno pyserial university-project

adv_arduino_ir_remote's People

Contributors

aleksanderkopec avatar kopunk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

adv_arduino_ir_remote's Issues

Return from submenu

void loop() {
  choice = Menu((sizeof(menuMain) / sizeof(menuMain[0])), menuMain);

  switch (choice) {

    case 0: // "Forward IR"
      lcd.print("Forward IR");
      forwardIR();
      break;

    case 1: // "Send IR"
      subchoice = Menu((sizeof(menuSend) / sizeof(menuSend[0])), menuSend);
      if (ButtonRead(analogRead(A0)) == 'l') {
        break;
      }
      else{
        sendIR(sequences[subchoice], sizeof(sequences[subchoice]) / sizeof(sequences[subchoice][0]));
      }
      break;
    ...

Jeśli ma nastąpić powrót i w menu użytkownik wcisnął 'left' to Menu() zwraca -1.

    case 1: // "Send IR"
      subchoice = Menu((sizeof(menuSend) / sizeof(menuSend[0])), menuSend);
      if (subchoice == -1) { // zamiast czytania z A0
        break;
      }
    ...

tak samo jest w case 4: // Settings

void forwardIR()

Dla basicButtonsSignals[3] jest sendIR(sequences[4]... itp

void forwardIR() {
  //sends sequences of signals depending on received signal
  while (true) {
    if (ButtonRead(analogRead(A0)) == 'l') {
      return;
    }

    long x = receiveSignal();
    
    if (x == 123){
      return;
    }
    
    if (x == basicButtonsSignals[0]) {
      sendIR(sequences[0], sizeof(sequences[0]) / sizeof(sequences[0][0]));
    }
    if (x == basicButtonsSignals[1]) {
      sendIR(sequences[1], sizeof(sequences[1]) / sizeof(sequences[1][0]));
    }
    if (x == basicButtonsSignals[2]) {
      sendIR(sequences[2], sizeof(sequences[2]) / sizeof(sequences[2][0]));
    }
    if (x == basicButtonsSignals[3]) {
      sendIR(sequences[4], sizeof(sequences[3]) / sizeof(sequences[3][0]));
    }
    if (x == basicButtonsSignals[4]) {
      sendIR(sequences[5], sizeof(sequences[4]) / sizeof(sequences[4][0]));
    }
    if (x == basicButtonsSignals[5]) {
      sendIR(sequences[3], sizeof(sequences[5]) / sizeof(sequences[5][0]));
    }
    if (x == basicButtonsSignals[6]) {
      sendIR(sequences[6], sizeof(sequences[6]) / sizeof(sequences[6][0]));
    }
    if (x == basicButtonsSignals[7]) {
      sendIR(sequences[7], sizeof(sequences[7]) / sizeof(sequences[7][0]));
    }
    if (x == basicButtonsSignals[8]) {
      sendIR(sequences[8], sizeof(sequences[8]) / sizeof(sequences[8][0]));
    }
    if (x == basicButtonsSignals[9]) {
      sendIR(sequences[9], sizeof(sequences[9]) / sizeof(sequences[9][0]));
    }
  }
}

jeśli numery mają być odpowiadające to można zastąpić to

void forwardIR() {
  //sends sequences of signals depending on received signal
  while (true) {
    if (ButtonRead(analogRead(A0)) == 'l') {
      return;
    }

    long x = receiveSignal();
    
    if (x == 123){
      return;
    }
    for (int i=0; i < 10; i++) {
        if (x == basicButtonsSignals[i]) {
          sendIR(sequences[i], sizeof(sequences[i]) / sizeof(sequences[i][0]));
        }
    }
  }
}

Number of Banks

Jest 10 zdefiniowanych banków z nazwami (Bank #1 - Bank #10)
Miejsce w pamięci jest wyznaczone dla 8

const int banksNamesAddr = 61; 
const int banksAddr = 173;

61 + 14*10 = 201
Możemy to naprawić czyniąc każdy następny adres zależnym od poprzedniego jeśli zmiana adresowania (dla banksAddr i otherSignals) nie wprowadzi chaosu.

const int connectPCAddr = 0;
const int basicButtonsAddr = 1;
const int additionalButtonsAddr = basicButtonsAddr + (4 * 10); // (4 * bankNo)
const int banksNamesAddr = additionalButtonsAddr + (4 * 5);
const int banksAddr = banksNamesAddr + (14 * 10);  // (bankNameLen * bankNo))
const int otherSignals = banksAddr + (4 * 10);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.