Show Posts
Pages: [1] 2 3
1  Using Arduino / Microcontrollers / Re: attiny85 interrupt rising edge on: August 29, 2013, 02:27:30 pm
thanx again jack.
i used the code you mentioned and its working as expected, but this detects the low level.
 
Code:
MCUCR &= ~(_BV(ISC01) | _BV(ISC00));      //INT0 on low level

according to the datasheet setting ISC01 and ISC00 to "1" it detects the rising edge.
im trying this change
Code:
MCUCR |= (_BV(ISC01) | _BV(ISC00));      //INT0 rising edge
but its not working.. any idea why?
2  Using Arduino / Microcontrollers / Re: attiny85 interrupt rising edge on: August 29, 2013, 01:49:58 pm
Oops i missed that. thank you
My question now is that can i get out of sleep with INT0?
here is my working code with state Change interrupt
Code:
#include <avr/sleep.h>

#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

int pinLed = 0;
int trimPin=3;

void setup(){
  pinMode(pinLed,OUTPUT);
  pinMode(1,INPUT);
  pinMode(3,INPUT);
 
  sbi(GIMSK,PCIE); // Turn on Pin Change interrupt
  sbi(PCMSK,PCINT1); // Which pins are affected by the interrupt
}

void loop(){

  digitalWrite(pinLed,HIGH);
  delay(2000);
  digitalWrite(pinLed,LOW);

 
  system_sleep();
}

void system_sleep() {
  cbi(ADCSRA,ADEN); // Switch Analog to Digital converter OFF
  set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Set sleep mode
  sleep_mode(); // System sleeps here
  sbi(ADCSRA,ADEN);  // Switch Analog to Digital converter ON
}

ISR(PCINT0_vect) {
}
3  Using Arduino / Microcontrollers / attiny85 interrupt rising edge on: August 29, 2013, 12:47:15 pm
Hello,
Im programming a ATtiny85 with this library http://hlt.media.mit.edu/?p=1229 .
I want to create an interrupt on pin1 and im using this code:
Code:
  sbi(GIMSK,PCIE); // Turn on Pin Change interrupt
  sbi(PCMSK,PCINT1); // Which pins are affected by the interrupt
the interrupt works as expected, it fires an interrupt on state Change.
Now i only want the interrput to fire on rising edge and not on state change.
Can anybody help me?
thanx
4  Topics / Home Automation and Networked Objects / arduino RN-XV WiFly Module ad hoc on: March 26, 2013, 05:27:38 am
Hello,
Im trying to make a connection between my laptop and arduino using RN-XV WiFly Module.
I will describe what i want to achieve and what ive done so far.
Ive set the wifly in ad hoc mode,connected in the wifly from my laptop and using this code in Mega
Code:
void setup() {               
        Serial.begin(9600);
        Serial3.begin(9600);
}
void loop() {
     if (Serial3.available()) {
    Serial.write(Serial3.read());
}
}

and reaching the address that ive set in my browser (i.e 192.186.1.1/test ) im getting this GET
Code:
*CLOS**OPEN*GET /test HTTP/1.1
Host: 192.168.1.1
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
So everything ok so far, now i want to create an html file in my laptop(acting as a local webserver) in order to make a button to control a led and then get and print to the html some values from the arduino
Can anyone direct me in order to find how i can establish this communication?

thank you
5  Using Arduino / Microcontrollers / Re: Bootloader on custom board with atmega2560 on: October 23, 2012, 05:25:32 am
A small update:
I tryed to burn the bootloader with an arduino mega 2560 as ISP.
Ive connected a led in pin 7 and one in pin 8. Now im getting the following:
When i try to burn the bootloader the led in pin 7 is on.
The RX TX led on the ISP arduino mega are showing activity.
After a minute im getting this error
Code:
avrdude: verification error, first mismatch at byte 0x1e000
         0xff != 0x0d
avrdude: verification error; content mismatch
And after this, in my new board the led in pin13 blinks but not as expected, ON for a second and the OFF for a second,
its doing 2 fast blinks, then off and the same again all the time..
Im really confused!
Can anyone help me?
6  Using Arduino / Microcontrollers / Re: Bootloader on custom board with atmega2560 on: October 23, 2012, 02:17:53 am
I just realized that in my print screen i dont have all the components in my schematic, some of them was out of the screen and i didnt realized that.
Anyway ive attached the correct one.
As you can see i have an SPI header which is where i connect it to the arduino duemilanove loaded with the isp program.
7  Using Arduino / Microcontrollers / Bootloader on custom board with atmega2560 on: October 22, 2012, 12:33:04 pm
Hello,
Ive build a new board with an atMega2560 and now im trying to flash the arduino bootloader. The method is through  and Arduino Duemilanove as ISP.
Im pretty sure that the connections between the two boards are correct, but when im trying to burn the bootloader i get this error: "Invalid device signature" Ive also tried with this method http://www.gammon.com.au/forum/?id=11635 but still cant upload the bootloader.
Do i have any mistakes in my schematic or can anyone imagine something that is wrong?
The board was printed in a fab so the connections are just like in the schematic.
thank you
8  Topics / Home Automation and Networked Objects / arduino and Nano WiReach SMT on: March 05, 2012, 05:02:11 pm
Hello,
Im trying to build a web server with arduino and the Nano WiReach SMT http://www.connectone.com/products.asp?did=73&pid=103
So far i was able just to set up the Nano WiReach SMT to my wifi network,pack and load a HelloWorld html successfully.
Im trying to find any further info for this module in order to communicate with arduino.
Basicly i want to control some led's in the ardino and read an analog input..
Does anyone has any experience with this module?
9  Using Arduino / Programming Questions / Re: amarino, sending data from arduino to android on: August 31, 2011, 11:32:02 am
Here is what i found in the cpp file:
Code:
void MeetAndroid::send(char c ){
Serial.print(startFlag);
Serial.print(c);
Serial.print(ack);
}
   startFlag = 18;
   ack = 19;

and here is the link of amarino http://www.amarino-toolkit.net/
10  Using Arduino / Programming Questions / Re: amarino, sending data from arduino to android on: August 31, 2011, 10:53:53 am
ok im posting the full code again..
android code
Code:

package nik.com;


import java.util.Scanner;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.widget.TextView;
import at.abraxas.amarino.Amarino;
import at.abraxas.amarino.AmarinoIntent;

public class Am_test extends Activity {
    /** Called when the activity is first created. */

private static final String DEVICE_ADDRESS =  "00:06:66:42:1F:C8";

private ArduinoReceiver arduinoReceiver = new ArduinoReceiver();

TextView testview;
String num;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
   
@Override
protected void onStart() {
super.onStart();
// in order to receive broadcasted intents we need to register our receiver
registerReceiver(arduinoReceiver, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));

// this is how you tell Amarino to connect to a specific BT device from within your own code
Amarino.connect(this, DEVICE_ADDRESS);
}

@Override
protected void onStop() {
super.onStop();

// if you connect in onStart() you must not forget to disconnect when your app is closed
Amarino.disconnect(this, DEVICE_ADDRESS);

// do never forget to unregister a registered receiver
unregisterReceiver(arduinoReceiver);
}

public class ArduinoReceiver extends BroadcastReceiver
{

@Override
public void onReceive(Context context, Intent intent)
{
String data = null;
int[] var= new int[10];


final String address = intent.getStringExtra(AmarinoIntent.EXTRA_DEVICE_ADDRESS);


final int dataType = intent.getIntExtra(AmarinoIntent.EXTRA_DATA_TYPE, -1);


if (dataType == AmarinoIntent.STRING_EXTRA)
{
data = intent.getStringExtra(AmarinoIntent.EXTRA_DATA);

testview = (TextView)findViewById(R.id.result);
    testview.setText(data);
   
            Scanner s = null;
            try
            {
                s = new Scanner(data);
                s.useDelimiter(",\\s*");
               
                int i=1;
                while (s.hasNext())
                {
                    if (s.hasNextInt())
                    {
                    var[i]= s.nextInt();
                       
                    }
                    else
                    {
                    s.next();
                       
                    }   
                    i++;
                }
            }
            finally
            {
                s.close();
                testview = (TextView)findViewById(R.id.textView1);
    testview.setText(Integer.toString(var[1]));
    testview = (TextView)findViewById(R.id.textView2);
    testview.setText(Integer.toString(var[2]));
    testview = (TextView)findViewById(R.id.textView3);
    testview.setText(Integer.toString(var[3]));
    testview = (TextView)findViewById(R.id.textView4);
    testview.setText(Integer.toString(var[4]));
    testview = (TextView)findViewById(R.id.textView5);
    testview.setText(Integer.toString(var[5]));
   
            }

}
}
}
}



arduino code
Code:
#include <MeetAndroid.h>

MeetAndroid meetAndroid;


void setup() 
{

  Serial.begin(57600);
 
  meetAndroid.send("1");
  meetAndroid.send(",");
  meetAndroid.send("2");
  meetAndroid.send(",");
  meetAndroid.send("3");
  meetAndroid.send(",");
  meetAndroid.send("4");
  meetAndroid.send(",");
  meetAndroid.send("5");
 
}

void loop()
{}



Im getting the following values on the android side

5
5
0
0
0
0
11  Using Arduino / Programming Questions / amarino, sending data from arduino to android on: August 29, 2011, 04:38:44 pm
Helllo,
I've played a little with the amarino library and so far im able to send values from android to arduino succesfully. Now i want to send some sensor reading from arduino to the android device.

I've wrote this code in android in order to get the values
Code:
public class ArduinoReceiver extends BroadcastReceiver
{

@Override
public void onReceive(Context context, Intent intent)
{
String data = null;
int[] var= new int[10];


final String address = intent.getStringExtra(AmarinoIntent.EXTRA_DEVICE_ADDRESS);


final int dataType = intent.getIntExtra(AmarinoIntent.EXTRA_DATA_TYPE, -1);


if (dataType == AmarinoIntent.STRING_EXTRA)
{
data = intent.getStringExtra(AmarinoIntent.EXTRA_DATA);

testview = (TextView)findViewById(R.id.result);
    testview.setText(data);
   
            Scanner s = null;
            try
            {
                s = new Scanner(data);
                s.useDelimiter(",\\s*");
               
                int i=1;
                while (s.hasNext())
                {
                    if (s.hasNextInt())
                    {
                    var[i]= s.nextInt();
                       
                    }
                    else
                    {
                    s.next();
                       
                    }   
                    i++;
                }
            }
            finally
            {
                s.close();
                testview = (TextView)findViewById(R.id.textView1);
    testview.setText(Integer.toString(var[1]));
    testview = (TextView)findViewById(R.id.textView2);
    testview.setText(Integer.toString(var[2]));
    testview = (TextView)findViewById(R.id.textView3);
    testview.setText(Integer.toString(var[3]));
    testview = (TextView)findViewById(R.id.textView4);
    testview.setText(Integer.toString(var[4]));
    testview = (TextView)findViewById(R.id.textView5);
    testview.setText(Integer.toString(var[5]));
   
            }

}
}
}

and something like this in the arduino side :

startFlag = 18;
ack = 19;

Serial.print(startFlag);
Serial.print(var[0]);
Serial.print(',');
Serial.print(var[1]);
Serial.print(',');
Serial.print(var[2]);
Serial.print(',');
Serial.print(var[3]);
Serial.print(',');
Serial.print(var[4]);
Serial.print(',');
Serial.print(ack);

the problem is that i get only the ack value on the phone. =\
can anyone help me?
12  Using Arduino / Sensors / Re: help reading adns-2051 on: February 25, 2011, 01:37:04 pm
Sorry i forgot it. Ive connect SCLK to digital pin 2 and SDIO to digital pin 3.
13  Using Arduino / Sensors / help reading adns-2051 on: February 25, 2011, 12:17:10 pm
Hello,
Im trying to read an optical sensor with arduino. So far i've build a circuit to connect the ADNS-2051 chip. I have post below the schematic. I have also connect the pd pin with digital pin 4 on the arduino. Im trying to read it with this code http://www.bidouille.org/files/hack/mousecam/Mouse_cam.pde but i cant and i dont know whats wrong. In the serial monitor when arduino start sending data it wrote me this "Found productId 0, rev. FF Unknown productID. Carry on." and then it keep giving me this "DELTA:-1 0" all the time although im moving the mouse.. Due to the datasheet i think that my connection is correct. Any thoughts of whats going wrong?

14  Forum 2005-2010 (read only) / Syntax & Programs / Re: faster sample rate. on: June 26, 2010, 05:00:46 am
Thanx for the reply. Ive build a pid line follower and at high speeds i think my problem is latency from the sampling process. So im sampling the ir sensors and after this doing a simple math function.
15  Forum 2005-2010 (read only) / Syntax & Programs / faster sample rate. on: June 25, 2010, 01:57:03 pm
How can i achieve the maximum sample rate when im reading an analog port? I read that the default adc conversion takes about 100us. Can i program it somehow to  get results faster?I know that this will affect the accuracy of the adc results but this is not critical to my project
thank you
Pages: [1] 2 3