ATtiny24 signal reding problem

Hello , I've got ATtiny24 and DIY IR Sensor ( IR semiconductor and IR transmitter ) , which generates signal from 0.6 to 5 volts ( power supply is 5 volts ) . I read in ATtiny24 documentation that pins on the one side are all ADC ( 8,9,10,11,12,13) and wrote code like this :

then I connect pin #6 to arduino pin A0 , then loading program to arduino for reading signal on A0 , but when I provoke sensor there is no signal change . what I don's do correctly ?

Don't take screenshots of your code, copy and paste the text. Then we can copy and paste lines we are interested in.

int IN = 10; //Pin #13
int OUT = 3; //Pin #6

void setup ()
{
pinMode (IN,INPUT);
pinMode (OUT,OUTPUT);
}

void loop ()
{
int val = analogRead (IN);
analogWrite (OUT,val);
}

fist of all, the analogRead returns a value from 0 to 1023, and analogWrite accepts a value from 0 to 255, so you'll have to map() it to the correct value like this:

analogWrite(OUT, map(analogRead(IN),0,1023,0,255) );

and i think you have to set the analogRead pin to high before you start reading, to set the pullup resistor (but i'm not sure about this)

Or just divide by four.

dxw00d: Or just divide by four.

ok, you beat me :)

still nothing it doesn't work .

giorgi111-111: I read in ATtiny24 documentation that pins on the one side are all ADC ( 8,9,10,11,12,13)

What documentation?

Have you tried hooking about something like a potentiomter to the analog pin to make sure the issue is on the device portion and not the sensor portion?

on Atmel webpage . there is no change whether I hook up potentiometer or sensor

giorgi111-111:
int IN = 10; //Pin #13
int OUT = 3; //Pin #6

void setup ()
{
pinMode (IN,INPUT); // <<<<<<<<<<<<<<< REMOVE THIS LINE OF CODE. pinMode is only used for digital I/O. <<<<<<<<<<<<<<<
pinMode (OUT,OUTPUT);
}

void loop ()
{
int val = analogRead (IN);
analogWrite (OUT,val);
}

A quick look at the datasheet reveals there is no analog input 10. The analog pins are 0 (ADC0) through 7 (ADC7).

From pins_arduino.c:

// ATMEL ATTINY84 / ARDUINO
//
//                           +-\/-+
//                     VCC  1|    |14  GND
//             (D  0)  PB0  2|    |13  AREF (D 10)
//             (D  1)  PB1  3|    |12  PA1  (D  9) 
//                     PB3  4|    |11  PA2  (D  8) 
//  PWM  INT0  (D  2)  PB2  5|    |10  PA3  (D  7) 
//  PWM        (D  3)  PA7  6|    |9   PA4  (D  6) 
//  PWM        (D  4)  PA6  7|    |8   PA5  (D  5)        PWM
//                           +----+

PIn 10 which you are using in the code appears to me to map to Aref.

and what does that mean ?

int IN = 10; //Pin #13

Arduino pin D10 (pin 13 on the chip) is not an input pin.

Maybe I'm wrong, but it is marked "AREF" - analog reference.

Physical pin 13 (PA0) can be an analog input or AREF (or a digital pin). If @giorgi111-111 is using the Tiny Core, by default VCC is the analog reference (like on an Arduino) so PA0 is available as an analog input. But, when that pin is used as analog input it is analog pin 0 (ADC0) not pin 10. Pin addressing for the 84 family is very similar to the addressing used on the 328 Arduino boards: digitals are numbered sequentially from the top-left to the top-right in a u-shape; analogs are numbered by the ADC label (ADC0 is analog 0, ADC1 is analog 1).