Trying to write code for Blood pressure monitor , Please give reveiw

#define sensor = A0;
#define airpump = 9;
#define airvalve = 8;

const int threshold = 45;
const int maxcuffPressure = 150;
const int optimumPressure = 120;

void setup() {
pinMode(sensor, INPUT);
pinMode(airpump, OUTPUT);
pinMode(airvalve, OUTPUT);
Serial.begin(9600);
}

void loop() {
sensorReading = analogRead(sensor);
if (sensorReading <= threshold) {
digitalwrite (airpump, HIGH);
}
if (sensorReading == maxcuffPressure) {
digitalwrite (airpump, LOW);
digitalwrite (airvalve, HIGH);
}
if (sensorReading == optimumPressure) {
digitalwrite (airvalve, LOW);
}
sensorReading = analogRead(sensor);
for{
int newsample = analogRead(sensor);
delay(100);
if (newsample > sensorReading){
swap (sensorReadsing = newsample);
}
}
int highest = sensorReading;
sensorReading = analogRead(sensor);
for{
int newsample = analogRead(sensor);
delay(100);
if (newsample < sensorReading) {
swap (sensorReading = newsample)
}
}
int lowest = sensorReading;

int MAP = (highest + lowest)/2;

int systol = (70% * MAP);
int dystol = (50% * MAP);
Serial.println(systol); // Display result
Serial.println(dystol);
}

Read this before posting a programming question

How to use this forum

Code tags please.

It doesn't compile, did you know that?

sketch_aug24b.ino: In function 'void setup()':
sketch_aug24b:10: error: expected primary-expression before '=' token
sketch_aug24b:10: error: expected primary-expression before ',' token
sketch_aug24b:10: error: expected `;' before ')' token
sketch_aug24b:11: error: expected primary-expression before '=' token
sketch_aug24b:11: error: expected primary-expression before ',' token
sketch_aug24b:11: error: expected `;' before ')' token
sketch_aug24b:12: error: expected primary-expression before '=' token
sketch_aug24b:12: error: expected primary-expression before ',' token
sketch_aug24b:12: error: expected `;' before ')' token
sketch_aug24b.ino: In function 'void loop()':
sketch_aug24b:17: error: 'sensorReading' was not declared in this scope
sketch_aug24b:17: error: expected primary-expression before '=' token
sketch_aug24b:17: error: expected primary-expression before ')' token
sketch_aug24b:17: error: expected `;' before ')' token
sketch_aug24b:19: error: expected primary-expression before '=' token
sketch_aug24b:19: error: expected primary-expression before ',' token
sketch_aug24b:19: error: expected `;' before ')' token
sketch_aug24b:22: error: expected primary-expression before '=' token
sketch_aug24b:22: error: expected primary-expression before ',' token
sketch_aug24b:22: error: expected `;' before ')' token
sketch_aug24b:23: error: expected primary-expression before '=' token
sketch_aug24b:23: error: expected primary-expression before ',' token
sketch_aug24b:23: error: expected `;' before ')' token
sketch_aug24b:26: error: expected primary-expression before '=' token
sketch_aug24b:26: error: expected primary-expression before ',' token
sketch_aug24b:26: error: expected `;' before ')' token
sketch_aug24b:28: error: expected primary-expression before '=' token
sketch_aug24b:28: error: expected primary-expression before ')' token
sketch_aug24b:28: error: expected `;' before ')' token
sketch_aug24b:29: error: expected `(' before '{' token
sketch_aug24b:29: error: expected primary-expression before '{' token
sketch_aug24b:29: error: expected `;' before '{' token
sketch_aug24b:53: error: expected primary-expression at end of input
sketch_aug24b:53: error: expected `;' at end of input
sketch_aug24b:53: error: expected primary-expression at end of input
sketch_aug24b:53: error: expected `)' at end of input
sketch_aug24b:53: error: expected statement at end of input
sketch_aug24b:53: error: expected `}' at end of input

Before trying to write something complex, write something simple. Your code is riddled with syntax and logical errors and I suggest you put it aside for now and look at, understand and run the example sketches that come with the IDE before you come back to it and have another go.

Apart from the “for” loop sections ( what’s going on there?), I can roughly see what you’re trying to do, but as the other guys have said, you really need to work through some examples.

#define sensor = A0;

Almost never “=”, almost never “;”

 int systol = (70% * MAP);

C/C++ does have a “%” operator, but it has very little to do with percentages.

if (sensorReading == maxcuffPressure)

Exactly equal is a rarity when analogRead is involved; better to use “>=” or “<=” depending g on which is more appropriate.