Problem sending values over serial to raspberry pi

I am trying to send values from my arduino to raspberry pi over serial (USB cable).

Here is very simple code:

    int someVal = 0;
    int inputPinA = A0;
    int pin = 0;

    void setup() {
    Serial.begin(9600); 
    }

    void loop() {
    someVal++;
    Serial.println(someVal);
    delay(100);
    pin = analogRead(inputPinA);
    Serial.println(pin);
    }

When my arduino is plugged into my windows PC, running the arduino IDE, this prints exactly as expected.
When my arduino is plugged into my raspberry pi, someval is printed as expected, but pin is just 0 repeating...
I tried changing int pin = 1; at the beginning to see if it would print 1 instead of 0, but still 0. I also tried Serial.println(String(pin)); which still printed 0.... what is going on here, I am stumped.

Raspberry pi python code:

import serial 

    ser = serial.Serial('/dev/ttyACM0', 9600,8,'N',1,timeout=None)
    ser_bytes = 0
    decoded_bytes = 0


    while True:
        ser_bytes = ser.readline()
        recoatVal = str(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))
        print(recoatVal)

I also simplified my python code to:

import serial 

    ser = serial.Serial('/dev/ttyACM0', 9600)
    ser_bytes = 0

    while True:
        ser_bytes = ser.readline()
        print(ser_bytes)

Which just returns(prints):

b '1\r\n' <----someVal

b '0\r\n'<----pin

Ok I figured it out... but need someone to actually explain it, as I don't think this counts as an answer. If I change int pin = 0 to float pin = 0 it works.... no idea why

On my Raspberry Pi this works fine with Python 2.7 and with Python 3.5.
It seems to be Raspberry problem.

  • Operating system up to date?
  • Python up to date?

My Raspberry holds the actual Raspbian Stretch.