Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: Frequency measure ATTINY85 on: October 31, 2013, 12:55:26 pm
thanks to all, seems that I would have to implement my own way to read frequency, what a pain.
2  Using Arduino / Project Guidance / Frequency measure ATTINY85 on: October 30, 2013, 08:14:04 am
Hi,
I have a project that uses freqMeasure library (http://www.pjrc.com/teensy/td_libs_FreqMeasure.html) with an arduino uno.
Now I want to make a small version of the project using ATTINY85, is there any frequency measuring library that works with ATTINY85?

Thanks!
3  Using Arduino / Networking, Protocols, and Devices / Re: Bluetooth HC-06 returns 3 times the same on: March 10, 2013, 11:05:22 am
Seems that the problem were the bluetooth terminal applications, they send something like '\n' or anything like this that I was not counting with.
4  Using Arduino / Networking, Protocols, and Devices / Bluetooth HC-06 returns 3 times the same on: March 07, 2013, 12:45:27 pm
Hi, I am trying to comunicate an arduino UNO with android using the famous HC-06 bluetooth module.
Sending things (char,Strings...) from android using a bluetooth terminal app works fine, the problem is that when I use Serial.println to send things to android from arduino it works but I always get what I sent 3 times repeated. I donĀ“t know why, the bluetooth module is with stock configuration, I don't used any AT commands for nothing.

This is the code in arduino:
Code:
char INBYTE;
int  LED = 13; // LED on pin 13

void setup() {
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
}
 
void loop() {

  Serial.println("bla bla bla");
  while (!Serial.available());   // stay here so long as COM port is empty   
  INBYTE = Serial.read();        // read next available byte
  if( INBYTE == '0' ) digitalWrite(LED, LOW);  // if it's a 0 (zero) tun LED off
  if( INBYTE == '1' ) digitalWrite(LED, HIGH); // if it's a 1 (one) turn LED on
  delay(50);
}

On android side I tryed several bluetooth terminal app's and all does the same, I always get:
bla bla bla
bla bla bla
bla bla bla

Thanks!
5  Using Arduino / Installation & Troubleshooting / arduino UNO forgets the code on: January 21, 2013, 07:59:18 pm
I don't know why but today my arduino UNO started to do a weird thing.
I upload blink example, all goes ok, then I unpulgged it and return to plug in and seems that arduino is restarting forever, L led blinks around 3 or 4 times very fast and do a pause.
Tested in W7 and ubuntu 10.04 with same results, arduino uno R3.
6  Using Arduino / Programming Questions / Re: Problem interrupting Serial.write on: July 17, 2012, 01:15:25 pm
Quote
anyway don't know exactly why but this solve the problem.
Most likely because the LOW was causing your interrupt handler and the Serial.write() interrupt handler to be fighting for priority. LOW causes your ISR to be called over and over as long as the pin is LOW, not just once as it transitions to LOW, as FALLING does.
I understand, thanks for a perfect help!!
7  Using Arduino / Programming Questions / Re: Problem interrupting Serial.write on: July 16, 2012, 08:37:20 pm
LOW is a really bad choice for the interrupt type. FALLING, if LOW is what pressed means, is a much better choice.

you are right, falling is much better interrupt type for what I want, anyway don't know exactly why but this solve the problem.
Thanks!
8  Using Arduino / Programming Questions / Re: Problem interrupting Serial.write on: July 16, 2012, 12:40:35 pm
Quote
The info is printed in a LCD and now I want use some pushbuttons to navigate by the lcd using interrupts.
Why? Why isn't polling fast enough?

This code is only for show my problem, In the real one I do lots of Serial.write() and stuff like that without passing by the loop() in some considerable time so in many cases arduino was too late for read my pulse (pushing the button).
9  Using Arduino / Programming Questions / Problem interrupting Serial.write on: July 16, 2012, 12:25:03 pm
Hi, I'm writing the code for a project that will interface an arduino with an engine control unit of a car.
Basically I send a byte to the unit and it responses with another byte with the info I want.
The info is printed in a LCD and now I want use some pushbuttons to navigate by the lcd using interrupts.
The problem is that when I trigger the button interrupt while the arduino is doing Serial communication with the unit, seems that all done in the ISR (for example change a variable value) is not executed or something like that.

wrote a simple code where this problem happens, I do my serial stuff in the loop inside the else statement and at the end I write the value of 'a', if button is pressed the if statement will notice it and will update the 'a' variable.


Code:
#include "Wire.h"
#include "LiquidCrystal.h"

LiquidCrystal lcd(7, 8, 12, 11, 13, A0);

volatile int button1 = 0;
int debouncing = 100;
int a = 1;

unsigned int ecuTimeout=10000;
unsigned long last_interrupt_time=0;

void setup() {
  Serial.begin(38400);  
  lcd.begin(20,4);
  pinMode(2,INPUT);
  digitalWrite(2,LOW);
  attachInterrupt(0, button1ISR, LOW);  
  lcd.clear();  
}

void loop() {
 
  if (button1 == 1){ //hey! I noticed the button have been pushed    
    a=a+1;
    button1=0;  
  }
  else{
   //here I am doing my standard serial things...    
   Serial.flush();
   Serial.write(0x20);
   unsigned int time=0;
   while(Serial.available() == 0 && time < ecuTimeout) time+=1;
   lcd.print(a);    
  }  
    
}

void button1ISR(){  
  unsigned long interrupt_time = millis();  
  if ((interrupt_time - last_interrupt_time > debouncing)){  
    button1=1;      
  }
  last_interrupt_time = interrupt_time;
}



This code prints '1' all the time, doesn't matter you press the button or not, but if I delete Serial.write(0x20); line it works ok, so I assume that something is happening when arduino is doing a serial.write and you interrput it.

any ideas?



 

Pages: [1]