element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum ARDUINO bitvoicer ir sending
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 4 replies
  • Answers 1 answer
  • Subscribers 392 subscribers
  • Views 397 views
  • Users 0 members are here
Related

ARDUINO bitvoicer ir sending

Former Member
Former Member over 9 years ago

hello

i've got problem with my program

im using arduino mega. when i use bit voicer and irremote the ir led is blink so slow that tv cannot get right signal to turn off. when i use only irremote everything is ok. So i thinking that bitvoicer is slowing down irremote or maybe my program is wrong. i tried different timer in irremote library but it isn't work.

can enyone help me in this??

 

 

CODE

 

#include <IRremote.h>

#include <IRremoteInt.h>

 

 

 

 

IRsend irsend;

 

#include <BitVoicer11.h>

//właczanie bita

BitVoicerSerial bvSerial = BitVoicerSerial();

byte dataType = 4;

int OutPutPins[] = {10,12,11,8};

int pinCount = 4;

int wl = 0 ;

void setup() {

  Serial.begin(115200);

  for(int activePin =0; activePin <pinCount; activePin++){

    pinMode(OutPutPins[activePin],OUTPUT);

  } 

   pinMode(7, OUTPUT);

   pinMode(9, OUTPUT);

   digitalWrite(7,HIGH);// put your setup code here, to run once:

pinMode(5,INPUT_PULLUP);

 

}

 

 

void loop() {

 

}

}

void serialEvent()

{

 

 

dataType = bvSerial.getData();

 

//Changes the value of sampleTest if the received data was

//the start/stop sampling command

if (dataType == BV_COMMAND)

 

 

//Signals BitVoicer's Speech Recognition Engine to start

//listening to audio streams after the engineRunning status

//was received

if (dataType == BV_STATUS && bvSerial.engineRunning == true)

   bvSerial.startStopListening();

 

 

if (dataType == BV_INT)

{

  int pinNumber = bvSerial.intData;

digitalWrite(pinNumber, !digitalRead(pinNumber));

delay(50);

}

// tutaj wartości string czyli pisane

if(dataType == BV_STR)

{

  if (bvSerial.strData == "okej")

  digitalWrite(7,LOW);

  delay(500);

digitalWrite(7,HIGH);

 

if (bvSerial.strData == "klas")

digitalWrite(9,HIGH);

delay(1);

 

if (bvSerial.strData == "klass")

digitalWrite(9,LOW);

 

if (bvSerial.strData == "komplet")

  irsend.sendNEC(0x5EA100FE, 32);

  delay(400);

  digitalWrite(7,LOW);

  delay(500);

  digitalWrite(7,HIGH);

  irsend.sendNEC(0x20DF10EF, 32);

 

if (bvSerial.strData == "wiez")

  irsend.sendNEC(0x7E8154AB, 32);

 

if (bvSerial.strData == "tv")

 

  irsend.sendNEC(0x20DF10EF, 32);

 

 

if (bvSerial.strData == "klim");

  irsend.sendNEC(0x8F758A7, 32);

 

if (bvSerial.strData == "h1")

irsend.sendNEC(0x5EA1E21C,32);

 

if (bvSerial.strData == "h2")

irsend.sendNEC(0x5EA152AC, 32);

 

if (bvSerial.strData == "h3")

irsend.sendNEC(0x5EA1B24C,32);

 

if (bvSerial.strData == "h4")

irsend.sendNEC(0x5EA10AF4,32);

 

if (bvSerial.strData == "mut")

irsend.sendNEC(0x5EA138C7,32);

 

if (bvSerial.strData == "rad")

irsend.sendNEC(0x5EA1609,32);

 

if (bvSerial.strData == "en")

irsend.sendNEC(0x5EA1C03E,32);

if (bvSerial.strData == "pc")

irsend.sendNEC(0x5EA100FE,32);

if (bvSerial.strData == "opt")

irsend.sendNEC(0x5EA1D628,32);

delay(400);

irsend.sendNEC(0x5EA1B946,32);

delay(400);

irsend.sendNEC(0x5EA17B84,32);

delay(400);

irsend.sendNEC(0x5EA17986,32);

delay(400);

irsend.sendNEC(0x5EA155AA,32);

delay(400);

irsend.sendNEC(0x5EA155AA,32);

 

if (bvSerial.strData == "hd")

irsend.sendNEC(0x5EA1D628,32);

delay(400);

irsend.sendNEC(0x5EA1B946,32);

delay(400);

irsend.sendNEC(0x5EA17B84,32);

delay(400);

irsend.sendNEC(0x5EA1F906,32);

delay(400);

irsend.sendNEC(0x5EA17B84,32);

delay(400);

irsend.sendNEC(0x5EA17B84,32);

if (bvSerial.strData == "opc")

irsend.sendNEC(0x5EA1D628,32);

if (bvSerial.strData == "cof")

irsend.sendNEC(0x5EA155AA,32);

delay(200);

irsend.sendNEC(0x20DF14EB,32);

if (bvSerial.strData == "wyj")

irsend.sendNEC(0x20DFDA25,32);

if (bvSerial.strData == "set")

irsend.sendNEC(0x5EA121DE,32);

if (bvSerial.strData == "ok")

irsend.sendNEC(0x5EA17B84,32);

delay(100);

irsend.sendNEC(0x20DF22DD,32);

if (bvSerial.strData == "dir")

irsend.sendNEC(0x5EA1BB44,32);

if (bvSerial.strData == "pros")

irsend.sendNEC(0x5EA16A95,32);

if (bvSerial.strData == "cis")

irsend.sendNEC(0x5EA1D827,32);

 

if (bvSerial.strData == "dol")

irsend.sendNEC(0x5EA139C6,32);

delay(100);

irsend.sendNEC(0x20DF827D,32);

if (bvSerial.strData == "gora")

irsend.sendNEC(0x5EA1B946,32);

delay(100);

irsend.sendNEC(0x20DF02FD,32);

if (bvSerial.strData == "pr")

irsend.sendNEC(0x5EA17986,32);

delay(100);

irsend.sendNEC(0x20DF609F,32);

if (bvSerial.strData == "lew")

irsend.sendNEC(0x5EA1F906,32);

delay(100);

irsend.sendNEC(0x20DFE01F,32);

if (bvSerial.strData == "inp")

irsend.sendNEC(0x20DFD02F,32);

if (bvSerial.strData == "tel")

irsend.sendNEC(0x20DFD02F,32);

delay(100);

irsend.sendNEC(0x20DFD02F,32);

if (bvSerial.strData == "jeden")

irsend.sendNEC(0x20DFD02F,32);

delay(100);

irsend.sendNEC(0x20DF22DD,32);

if (bvSerial.strData == "dwujka")

irsend.sendNEC(0x20DF48B7,32);

delay(100);

irsend.sendNEC(0x20DF22DD,32);

if (bvSerial.strData == "trujka")

irsend.sendNEC(0x20DFC837,32);

delay(100);

irsend.sendNEC(0x20DF22DD,32);

if (bvSerial.strData == "polsat")

irsend.sendNEC(0x20DF28D7,32);

delay(100);

irsend.sendNEC(0x20DF22DD,32);

if (bvSerial.strData == "tvn")

irsend.sendNEC(0x20DFA85,32);

delay(100);

irsend.sendNEC(0x20DF22DD,32);

if (bvSerial.strData == "next")

irsend.sendNEC(0x20DF00FF,32);

 

if (bvSerial.strData == "prev")

irsend.sendNEC(0x20DF807F,32);

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 9 years ago +1 suggested
    Your code is hard to follow, because it is missing indentation. You can edit your post, and use the syntax highlighting tool in the editor on this website (Click on the icon that looks like '>>' and navigate…
  • Robert Peter Oakes
    Robert Peter Oakes over 9 years ago +1 verified
    Asside from the comments from Shabaz which I totally agree with, indentation and neat readable code is essential in helping with debuging there is one obvious thing wrong with your code if (bvSerial.strData…
Parents
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago

    Asside from the comments from Shabaz which I totally agree with, indentation and neat readable code is essential in helping with debuging

     

    there is one obvious thing wrong with your code

    if (bvSerial.strData == "dol") irsend.sendNEC(0x5EA139C6,32);
    delay(100);
    irsend.sendNEC(0x20DF827D,32);
    if (bvSerial.strData == "gora") irsend.sendNEC(0x5EA1B946,32);
    delay(100);

     

    you have no "{ }" arround your if code so only the first command after the if will be executed if the "IF" is true and everthing after that will always be executed, this includes ALL your delays and ALL the additional send commands

     

    to contain a sequence of code to only work if the "IF" is true / to be run then it is essential you encapsulate the code with the curly braces

     

    regards

    Peter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • shabaz
    0 shabaz over 9 years ago in reply to Robert Peter Oakes

    Agree, it is bad structure.

    There are only about 35 commands in C misiek271 so good to scan through them( before you begin any coding project if you're a beginner),

    so that you can see what tools (which is what these commands are) are best used for the coding sub-task that you are trying to achieve.

     

    If you use a nail to solve everything, your code gets long and difficult to follow, and hence the errors.

    There are more elegant structures, and they often (not always) leads to more readable code and less errors and save you time.

     

    Half a day looking through the 35 or so commands and their structure will speed you up and save you days/weeks/months of coding and troubleshooting time.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to shabaz

    yes im newbie. And ill check this command. Problem is solved. and everything work's fine because of You. So thanks again.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 9 years ago in reply to shabaz

    yes im newbie. And ill check this command. Problem is solved. and everything work's fine because of You. So thanks again.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube