Exercise 1
Same notes, different chords. It’s a great way to create a pattern, thus logic in your improvisation. For some chords you may have to adjust your melody a bit, but there’s still a sense of logic.
Exercise 2
Notice the difference between the two quarter notes on the beat in bar 2 and the last eighth note of that bar which is off beat (but still on a logical sounding equal division of the beat). On the beat creates rest and emphasizes the beat (the groove, the swing in this case). Off beat creates tension.
Exercise 3
Added a blue note (the b5 of the key, from the blues scale of the key: 1,b3,4,b5,5,b7). There are different varieties of blues scales, not just one, but this is the one used most often.
Exercise 4
Added a triplet for rhythmic variation.
Exercise 5
And a lot more triplets in the last bar featuring the blues scale of the key.