Hi,
I'm making a project to cool or warm a body part using a Peltier module. I'm trying to control it by driving it with a IFX9201SG Infineon driver controled by arduino Nano using a PWM port to control the duty cycle, a digital port for direction and another to enable or disable the driver. However, the driver signaled an error. This driver has diagnosis using SPI protocol but when I try to comunicate with it with arduino it only returns 0's. Could anyone help me?
This is my setup.
nt erro=4;
SPISettings settings(20000, MSBFIRST, SPI_MODE2);
void setup() {
// put your setup code here, to run once:
pinMode(3, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(2, OUTPUT);
pinMode(erro, INPUT);
pinMode(9, OUTPUT);
pinMode(10,OUTPUT);
Serial.begin(9600);
SPI.begin();
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(9, 0);
digitalWrite(2, 1);
analogWrite(3, 255);
SPI.beginTransaction(settings);
digitalWrite(10,LOW);
byte mensagem=SPI.transfer(0b000);
delay(500);
digitalRead(erro);
Serial.println(mensagem);
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.