Programming of the ATTINY85 on my camera  

Discuss cameras used for shooting panoramas, virtual tours or 360° videos (GoPros, DSLRs, one shot cams, etc..) and their various accessoires (lenses, monopods/tripods, etc...).
(EN/FR Forum)
no avatar
adawang
New member
 
Topic author
Posts: 2
Likes: 2 posts
Liked in: 0 post
Joined: Tue Dec 06, 2016 7:51 am
Info

Programming of the ATTINY85 on my camera

by adawang » Wed Apr 05, 2017 7:59 am

Hi,

Still working on my camera trap and need to have a very basic program to control two outputs with one input.

It is an infrared camera trap working on a 38khz system, everything is already made except for the programming of the ATTINY85 that will run it.

I need two outputs: when one is high, the other needs to be low and vice versa so that when the beam from the emitter is being received, output 1 is high and output 2 is low. Breaking of the beam would reverse this and when the beam is visible again it would go back to its original state.

The input is from the output of a TSSAL through an optocoupler, so basically a switch.

This is the code I have, and it does not work, and I cannot figure out why.

Code: Select all
const int LED1 = 0;
const int LED2 = 1;
const int SW = 2;

 int val=0;

void setup()
{
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(SW, INPUT);
  }

 void loop()
 {
   val=digitalRead(SW);
if(val==0)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2,LOW);

}
else

   val=digitalRead(SW);
if(val==1)
{
  digitalWrite(LED1,LOW);
  digitalWrite(LED2,HIGH);

}
 }
 


Something I also would like to see is each time the outputs change, there is a slight delay of maybe 60ms before the output that is being switched off goes to low, but no delay in the other output going to high - so a bit of an overlap. This is important for the camera as it needs 56ms to respond.

Any help is greatly appreciated.

Thanks

User avatar
Christian Stüben
Member
 
Posts: 363
Likes: 3 posts
Liked in: 7 posts
Joined: Tue Jul 03, 2012 5:08 am
Location: Wuppertal, Germany
Info

Re: Programming of the ATTINY85 on my camera

by Christian Stüben » Fri Apr 21, 2017 7:02 am

try to change the loop code:


void loop()
{
if(digitalRead(SW)==0)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2,LOW);
}
else
{
digitalWrite(LED1,LOW);
digitalWrite(LED2,HIGH);
}
}

Do you really need the val variable? is it needed somewhere else in your code?

I dont know the attini and its compilers, and what might be done automatically for a procedure that is called loop.
In my opinion without additional code, it really doesnt loop.

greetings from germany
Chris

User avatar
Christian Stüben
Member
 
Posts: 363
Likes: 3 posts
Liked in: 7 posts
Joined: Tue Jul 03, 2012 5:08 am
Location: Wuppertal, Germany
Info

Re: Programming of the ATTINY85 on my camera

by Christian Stüben » Fri Apr 21, 2017 7:10 am

for the funny delay problem, try to exchange the sequence you set the led to high and low.

no avatar
Somebody
New member
 
Posts: 1
Likes: 0 post
Liked in: 0 post
Joined: Thu Jun 22, 2017 7:29 am
Info

Re: Programming of the ATTINY85 on my camera

by Somebody » Thu Jun 22, 2017 7:48 am

Has the same problem a while ago, good to know I am not the only one tp strugge with it ;)
I wrote to the shop, they helped me out quickly.
Now all is great, making decent pictures of real estate in Barcelona https://tranio.com/spain/catalonia/barcelona/

no avatar
tommyhulk
New member
 
Posts: 1
Likes: 0 post
Liked in: 0 post
Joined: Fri Jun 30, 2017 9:07 am
Info

Re: Programming of the ATTINY85 on my camera

by tommyhulk » Fri Jun 30, 2017 9:17 am

I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.
http://sli-therio.com

no avatar
Tooom
New member
 
Posts: 2
Likes: 0 post
Liked in: 1 post
Joined: Tue Aug 15, 2017 9:10 am
Info

Re: Programming of the ATTINY85 on my camera

by Tooom » Tue Aug 15, 2017 9:13 am


no avatar
annashetty
New member
 
Posts: 1
Likes: 0 post
Liked in: 0 post
Joined: Thu Sep 14, 2017 9:33 am
Info

Re: Programming of the ATTINY85 on my camera

by annashetty » Tue Dec 05, 2017 4:59 am

You have posted a very detail document. I read all of your article and I really like it, I understand your point of view.
-----------------
photoshop online, cool math games

no avatar
pagliladki
New member
 
Posts: 2
Likes: 0 post
Liked in: 0 post
Joined: Fri Dec 08, 2017 10:20 am
Info

Re: Programming of the ATTINY85 on my camera

by pagliladki » Fri Dec 08, 2017 10:26 am

Thanks for sharing nice views on cameras http://pagliladki.com/good-night-sms/

no avatar
kakbrus
New member
 
Posts: 1
Likes: 0 post
Liked in: 0 post
Joined: Sat Dec 09, 2017 4:26 am
Info

Re: Programming of the ATTINY85 on my camera

by kakbrus » Sat Dec 09, 2017 4:29 am

This article is very useful. My friend suggest me to use this blog. thank so much! five nights at freddy's


Who is online

Users browsing this forum: No registered users and 1 guest